Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Create a file from a form input using PHP

Hello can someone help me, I need to create a file from a form input using php.

edit: I changed the tag from General Discussion to PHP

3 Answers

Pretty broad question, but basically you would POST the values from the form to a page that would process the $_POST variable and write it's contents to a file.

The basics are fopen(), fwrite(), fclose() .

You can also use the all in one file_put_contents

Basic PHP File handling

Or is this user trying to generate a form using PHP in that case its just as easy as:

<?php

echo '<input type="text" name="example" id="example" />';

Thanks.