howdy
I pieced together a form processing script. I've basically got everything working, except for one thing...now I know it might be ugly, but im just starting to learn PHP =)
The one part of it thats not working right is the db insert. It is inserting each value on a differnt row in the db.
Anyone know what i can change to make this thing insert all the $Name and $Value's on the same row in the db?
Heres the script... thanks!
<?php
global $HTTP_POST_VARS, $HTTP_GET_VARS;
$Method = (isset($HTTP_POST_VARS)) ? "Post" : "Get";
$FormVariables = ($Method == "Post") ?
$HTTP_POST_VARS :
$HTTP_GET_VARS;
$db = mysql_connect("localhost", "test", "test");
mysql_select_db("test",$db);
foreach ($FormVariables as $Name=>$Value) {
echo "$Name : $Value";
$sql = "INSERT INTO table1 ($Name) VALUES ('$Value')";
$result = mysql_query($sql);
}
exit;
?>