0

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='{$client['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>'
?>
Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
Sujit Tiwari
  • 263
  • 2
  • 5
  • 15

1 Answers1

0

Leave the action blank or use $_SERVER['REQUEST_URI']. This is the page currently shown in the browser.

Kaken Bok
  • 3,395
  • 1
  • 19
  • 21