Not able to append data to a file using php -


i new php , in learning process. tried writing data file , worked.

now tried adding data added user file in append mode, have not idea why not working out.

code :

<?php  if(isset($name)){     $name=$_post['data'];     if (!empty($name)) {         $handle=fopen("name.txt", 'a');         fwrite($handle, $name."\n");         fclose($handle);         echo "added file sucessfully !";     }else{         echo "please enter name in text box !";     } }   ?> <form action="nwfile.php" method="post"> <input type="text" name="data"> <input type="submit" value="submit"> </form> 

i not able find issue code , have no idea why no data getting written in file.

try use if(isset($_post['data'])){

<?php if(isset($_post['data'])){     $name=$_post['data'];     if (!empty($name)) {         $handle=fopen("name.txt", 'a');         fwrite($handle, $name."\n");         fclose($handle);         echo "added file sucessfully !";     }else{         echo "please enter name in text box !";     } }   ?> <form action="" method="post"> <input type="text" name="data"> <input type="submit" value="submit"> </form> 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -