jin_10 Posted October 10, 2008 Share Posted October 10, 2008 Hey, I have a html form ready. What I want to do is the form to save a seperate html file for each submission with the filename to have the name field value and date field value. For e.g. the form has fields for Date, Name and comments. let say jack submits form today then the filename would be '20081010_jack.html' and when george submits the form then the filename would be '20081010_george.html' Thanks in advance for your time. Link to comment https://forums.phpfreaks.com/topic/127826-php-form-processing-help/ Share on other sites More sharing options...
Stooney Posted October 10, 2008 Share Posted October 10, 2008 This is about as basic as I can make an example. Make sure the directory it's in allows writing of files. form.php <?php if(isset($_POST['name']) && strlen($_POST['name'])>0){ $file=$_POST['date'].'_'.$_POST['name'].'.html'; $handle=fopen($file, "w"); fwrite($handle, $_POST['comments']); fclose($handle); } ?> <form action="form.php" method="post"> <input type="text" name="name"> <input type="text" name="date"> <textarea name="comments"></textarea> Link to comment https://forums.phpfreaks.com/topic/127826-php-form-processing-help/#findComment-661761 Share on other sites More sharing options...
jin_10 Posted October 10, 2008 Author Share Posted October 10, 2008 Thanks for your quick reply. Say if I change 'w' to 'a' in this command $handle=fopen($file, "w"); and then if two guys with same name post on the same day will it append in the file. Link to comment https://forums.phpfreaks.com/topic/127826-php-form-processing-help/#findComment-661794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.