form action in page.tpl
dear all my script is such that i have to submit it every 60 seconds so i have put this code in my page.tpl.php file but that is included in some files and it cant be executed alone .
so in below code what should i give the form action value. i have given self but self will go to page.tpl.php. inpite of everything is correct i am not getting anything entered in mysql .
please tell how to do . i cant call this page seperately as all variables need to be defined once again .please help
<?php
$res = mysql_query("select * from `".tb()."accounts` where id='{$cli开发者_开发知识库ent['id']}'");
$row = mysql_fetch_array($res);
$Time = $row['Time_Spent'];
mysql_query ("insert into ".tb()."accounts(Time_Spent) values ('{$Time}') where uid='{$client['id']}' ");
echo '<form name="form1" method="post" action="'.$_SERVER['PHP_SELF'].'">
<p>Total Earning: <input name="Time_Spent" value="'.$Time.'" id="Time_Spent" type="text" size="7" /></p>
<input type="submit" name="Submit" value="submit" />
</form>'
?>
Leave the action blank or use $_SERVER['REQUEST_URI']. This is the page currently shown in the browser.
精彩评论