Hope I can get some help with a quick question
Posted: Wed Mar 05, 2008 1:45 am
I'm new to PHP, and I've been experimenting with some tutorials and such. I wanted to create a text file from an html form, so far I have been successful.
My question is:
Can I establish a variable value as the name of the txt file that I want to create?
I mean: If the html form retireves a person's name, can I use the name as the text file name that PHP can create for me?
Example
***** PLEASE USE THE
And then the PHP script that process the form:
Thanks in advance for taking questions?
Juan Carlos
My question is:
Can I establish a variable value as the name of the txt file that I want to create?
I mean: If the html form retireves a person's name, can I use the name as the text file name that PHP can create for me?
Example
***** PLEASE USE THE
Code: Select all
ORCode: Select all
TAGS *****[/color]
html code:Code: Select all
<form action="form.php" method="post" name="form1">
<label>Name
<input type="text" name="name" id="name" />
</label>
<label>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</label>
</form>Code: Select all
<?php
$name = "name";
$fp = fopen("[b]john_doe.txt"[/b], "w");
fwrite($fp, $your_data);
fclose($fp);
?>
Juan Carlos