prcollin Posted May 22, 2008 Share Posted May 22, 2008 Basically i have a form and below it (on the code side not display side) i have an html document. The variables in the html document are reflective of what is entered in the form So say i have a text box <input type="text" name="title"> Then I set that $title = 'title' IN the html portion of the form there is a place for the title of the site <title> $title </title> And the whole html document is refelctive of what the user enters. SO i have all that working and when they click submit it sends me an email with all of hte correct code and user inputs form the form. Right now I have to take the code, place it in a notepad, save it as .html or .php then upload it to my server. Is there an easy way to just have the new file created just post to the server as a .html or .php? Each time a user signs up I want the new information to post to a new directory and save itself as a new .html or .php file Quote Link to comment https://forums.phpfreaks.com/topic/106764-solved-ok-so-i-rewrote-my-questionproblem-to-make-it-more-clear/ Share on other sites More sharing options...
MatthewJ Posted May 22, 2008 Share Posted May 22, 2008 <?php $fp = fopen('data.php', 'w'); fwrite($fp, '<p>Your code</p>'); fclose($fp); ?> Just write it out to file. Quote Link to comment https://forums.phpfreaks.com/topic/106764-solved-ok-so-i-rewrote-my-questionproblem-to-make-it-more-clear/#findComment-547292 Share on other sites More sharing options...
mlin Posted May 22, 2008 Share Posted May 22, 2008 to make new directories...use mkdir() Quote Link to comment https://forums.phpfreaks.com/topic/106764-solved-ok-so-i-rewrote-my-questionproblem-to-make-it-more-clear/#findComment-547296 Share on other sites More sharing options...
prcollin Posted May 23, 2008 Author Share Posted May 23, 2008 to make new directories...use mkdir() So how do you get each new submission to save as a file in the new directory Quote Link to comment https://forums.phpfreaks.com/topic/106764-solved-ok-so-i-rewrote-my-questionproblem-to-make-it-more-clear/#findComment-548024 Share on other sites More sharing options...
Darghon Posted May 23, 2008 Share Posted May 23, 2008 mkdir(foldername to be created) makes the folder you can trigger it on submission if you want a file in the folder, make sure you keep the folder name and just $filetosave = fopen($folder.$filename,'w'); fclose($filetosave); to save it and you're done Quote Link to comment https://forums.phpfreaks.com/topic/106764-solved-ok-so-i-rewrote-my-questionproblem-to-make-it-more-clear/#findComment-548028 Share on other sites More sharing options...
prcollin Posted May 23, 2008 Author Share Posted May 23, 2008 mkdir(foldername to be created) makes the folder you can trigger it on submission if you want a file in the folder, make sure you keep the folder name and just $filetosave = fopen($folder.$filename,'w'); fclose($filetosave); to save it and you're done Thank you very much Quote Link to comment https://forums.phpfreaks.com/topic/106764-solved-ok-so-i-rewrote-my-questionproblem-to-make-it-more-clear/#findComment-548089 Share on other sites More sharing options...
prcollin Posted May 23, 2008 Author Share Posted May 23, 2008 mkdir(foldername to be created) makes the folder you can trigger it on submission if you want a file in the folder, make sure you keep the folder name and just $filetosave = fopen($folder.$filename,'w'); fclose($filetosave); to save it and you're done one more question. If there is no file with that name already in the directory it will just create a new one with it right? Quote Link to comment https://forums.phpfreaks.com/topic/106764-solved-ok-so-i-rewrote-my-questionproblem-to-make-it-more-clear/#findComment-548093 Share on other sites More sharing options...
.josh Posted May 23, 2008 Share Posted May 23, 2008 yes. But if there is a file in that directory with the same name, it will overwrite it. Quote Link to comment https://forums.phpfreaks.com/topic/106764-solved-ok-so-i-rewrote-my-questionproblem-to-make-it-more-clear/#findComment-548261 Share on other sites More sharing options...
prcollin Posted May 23, 2008 Author Share Posted May 23, 2008 yes. But if there is a file in that directory with the same name, it will overwrite it. Ok thanks Quote Link to comment https://forums.phpfreaks.com/topic/106764-solved-ok-so-i-rewrote-my-questionproblem-to-make-it-more-clear/#findComment-548318 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.