Page 1 of 1

File creator from PHP

Posted: Fri Jan 28, 2011 8:09 pm
by Pazuzu156
I'm creating a website for my teacher. They are not very bright with html, so I'm making it easier on them by making a php based page generator.
What I'm looking for here is I need to know how to create a file based on user input. Basically:

Code: Select all

<?php
if(isset($_POST['submit'])) {
    $pageName=$_POST['pageName'];
    if($pageName) {
        //code to make file
    }
}
?>
where $pageName would show up as the header at the top of the page, and others for the lesson content.

Re: File creator from PHP

Posted: Sat Jan 29, 2011 9:15 am
by endyourif
Check out the function file_put_contents(): http://php.net/manual/en/function.file-put-contents.php

You may also wish to look at implementing a WYSIWYG editor like TinyMCE or CKEditor.

Re: File creator from PHP

Posted: Sat Jan 29, 2011 12:26 pm
by Pazuzu156
Thank you very much, this helped me a lot!