File creator from PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

File creator from PHP

Post 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.
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
endyourif
Forum Newbie
Posts: 7
Joined: Wed Jan 26, 2011 6:53 pm

Re: File creator from PHP

Post 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.
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Re: File creator from PHP

Post by Pazuzu156 »

Thank you very much, this helped me a lot!
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
Post Reply