Writing text to a file [PHP, HTML] -


i want write text bottom of existing text file don't have clue how it.

i have tried code below don't work. text file location c:\inetpub\wwwroot\test.txt

<?php      if(isset($_post['submit'])){         $email = $_post['email'];         $file = fopen("c:\inetpub\wwwroot\test.txt\\","a+");         fwrite($file,$email);         fclose($file);          print_r(error_get_last());     } ?>  <form action= "" method="post" name="form"> <input type="text" name="email"> <br> <br> <input type="submit" name="submit" value="submit"><br> </form> 

what doing wrong?

try

file_put_contents("file_path", your_content, file_append); 

so in case...

<?php     if(isset($_post['submit'])) {         $email = $_post['email'];         file_put_contents("c:\inetpub\wwwroot\test.txt", $email, file_append);     } ?> 

documentation here.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -