PDA

View Full Version : Posting variable data into MySQL database


redgtsviper
03-09-2007, 01:28 AM
Ok, I hope I can explain what I am trying to do.

I have a form on my page with a few fields. For example reasons lets say one field is "FIRSTNAME" and the other is "LASTNAME" when my page is processed it take these two fields and make these two into one word "FIRSTNAMELASTNAME" I have a this data sent to variable ($names = FISTNAMELASTNAME).

How can I get this to post into my database from the variable so my insert will be "FIRSTNAMELASTNAME"

I have already established my database connection. I can get data from other forms fields directly into the database. So I guess what I am asking is how can I post the data from my varibale $names. What would be the correct line of code for it.

Inigoesdr
03-09-2007, 01:40 AM
$data = $_POST['FIRSTNAME'] . $_POST['LASTNAME'];

redgtsviper
03-09-2007, 01:49 AM
I do not understand what "$data" is. They way I have it setup is my 2 fields get put together like so "John_Doe" and it make my variable $name = John_Doe

How can I post just the result and make $name get posted into my database

would it be:

$_POST['$name']