PHP Newsletter

Join now and receive weekly updates pertianing to the world of PHP.

Polls

What do you think about the new PHPMine Design?
Awesome
Not Bad
Sucks

PHP Gigs By City

PHP Jobs By Topic

Advertisements

I have an HTML textbox that I want to access from PHP code because I want to write the textbox's value to file?

Asked 2010-02-06 20:57:01 by Jonathan W

How do I do that? I'm open to alternatives using JavaScript as well if that's possible.
I cant access the data using some code from the same page?
I have it sent to a plain text file.

Anwered 2010-02-06 21:05:17 by spk

Ok. I think this is what you want. You have a textbox, and you write in it. You click submit and it makes a file with it.
<html>
<body>
<form action="post" name="f1">
<textarea name="f12"></textarea>
</form>
</body>
</html>
<?php
$textarea=$_POST["f12"];
if($textarea != NULL)
{
$ip=$_SERVER['REMOTE_ADDR'];
$filename = $ip . rand(1000) . ".txt";
file_put_contents($filename, $textarea, FILE_APPEND);

}
?>

Anwered 2010-02-06 21:28:56 by JayCeeVee

give me your HTML code(the text-box) and i will give you the php solution. also do you have it sent to a database or just plain text file?

Questions and answers provided by the Yahoo Answers Community.