Example:
Lets say I have 3 textfields called text1, text2, and text3 and the user enters into the text1 field the letter x, the text 2 field the letter y and the text3 field the letter z. When the user clicks the submit button the values of those 3 textfields would be passed to the database table column called textFieldValues and look like this:
$text1 = "x", $text2 = "y", $text3 = "z"
Then I could later pull the data down from that same table and use all those variables in a different page.
Many thanks to anyone who could help. The code i am starting from looks like this
Code: Select all
<?php
$con = mysql_connect("localhost","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$sql="INSERT INTO my_table (textFieldValues)
VALUES
('$_POST[text1]','$_POST[text2]','$_POST[text3]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>