PHP form question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'am new to php and have a question.
I have a php form with a textarea (name = MyData) and like to add the text  
to a variable.
After that i 'd like to store this info to my database.

How can i add this text to a variable ?

I appreciate some help,


Re: PHP form question

Quoted text here. Click to load it
Andy Hassall :: :: :: disk and FTP usage analysis tool

Re: PHP form question

W3 School's tutorial is a good one too,

Re: PHP form question

I would recommend that you do read the sources that Andy and Robizzle  
sent but here is a down and dirty way to do it.

Your 'textarea' will send the data just like all the other fields and  
can be accessed in the $_POST[] globalvariable array.

So if you set a text filed like:
<textarea name="MyData" cols="30" rows="3" id="MyData"><?php echo  

The the data sent will be in the variable $_POST['MyData'].

Then on your processing page just retrieve that data and place it in  
your database.
It is probably a good idea to make sure the Table Field is a 'text'  
field type to handle large inputs or such.

$my_data = $_POST['MyData'];
$insert = "INSERT INTO tableName(MyData)VALUES($my_data)";

I hope this is what you are looking for.
If you need more help or more details on error checking or such post  
here or write me at:

Jeanine wrote:
Quoted text here. Click to load it

Re: PHP form question

Thanks all of you.
I take some time to work with it.
Thanks for the links and example.


Site Timeline