php - how can i run my code inside the ifstatement when i click the button -


Hello friends, I need help in this code, I want to log a user, which is my problem .txt When I click the button, see the example button, if the statement below is not working ... then do not know why ..

Trying to call this code

  echo & lt; Form METHOD = "POST" action = "mydata2.php" & gt; & Lt; INPUT TYPE = "submit" name = "submit" value = "see" & gt; & Lt; / Form & gt; '; If (isset ($ _ POST ['submit']) & amp; amp; ($ _POST ['submit'] == "see")) {$ date = date ("Wi-M-DH: I "); $ Updatefile = "userlogs.txt"; $ FH = FOPN ($ updatefile, 'a') or die ("can not open file"); $ StringData = "User: $ username"; FILIT ($ FAH, "$ stringdata" .PHP_EOL); $ StringData = "Date of Viewing Click Button"; FILIT ($ FAH, "$ stringdata" .PHP_EOL); Fclose ($ fh); }  

Sorry for the bad English .. When you click the View button, I will run the code above.

Try it

file1.php < / P>

  echo '& lt; Method = "POST" action = "mydata2.php" & gt; & Lt; Input type = "submit" name = "submit" value = "view" & gt; & Lt; / Form & gt; ';  

mydata2.php

is not defined in this $ user name , you should define it.

  if (isset ($ _ POST ['submit']) & amp; ($ _POST ['submit'] == "see")) {$ username = "your_username "; // Define it $ date = date ("Y-M-DHH: I: S"); $ Updatefile = "userlogs.txt"; $ FH = FOPN ($ updatefile, 'a') or die ("can not open file"); $ StringData = "User: $ username"; Filitt ($ fah, $ string.dta.php_ool); $ StringData = "Date of Viewing Click Button"; Filitt ($ fah, $ string.dta.php_ool); Fclose ($ fh); }  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -