I have an html page with textfields… 18 of them… and they are to add information to my databse. However, nothing gets submitted, and I don’t know why. Here is my php:
<?php;
$db_host = "localhost";
$db_user = "name";
$db_password = "pass";
$db_name = "database";
$gallery=$_POST['gallery'];
$f1=("$_POST[f1]");
$t1=("$_POST[t1]");
$f2=("$_POST[f2]");
$t2=("$_POST[t2]");
$f2=("$_POST[f2]");
$t2=("$_POST[t2]");
$f3=("$_POST[f3]");
$t3=("$_POST[t3]");
$f4=("$_POST[f4]");
$t4=("$_POST[t4]");
$f5=("$_POST[f5]");
$t5=("$_POST[t5]");
$f6=("$_POST[f6]");
$t6=("$_POST[t6]");
$f7=("$_POST[f7]");
$t7=("$_POST[t7]");
$f8=("$_POST[f8]");
$t8=("$_POST[t8]");
$f9=("$_POST[f9]");
$t9=("$_POST[t9]");
$image1=$f1;
$left1=("gallery.php?img=$f9&gal=$gallery&name=$t9");
$right1=("gallery.php?img=$f2&gal=$gallery&name=$t2");
$image2=$f2;
$left2=("gallery.php?img=$f1&gal=$gallery&name=$t1");
$right2=("gallery.php?img=$f3&gal=$gallery&name=$t3");
$image3=$f3;
$left3=("gallery.php?img=$f2&gal=$gallery&name=$t2");
$right3=("gallery.php?img=$f4&gal=$gallery&name=$t4");
$image4=$f4;
$left4=("gallery.php?img=$f3&gal=$gallery&name=$t3");
$right4=("gallery.php?img=$f5&gal=$gallery&name=$t5");
$image5=$f5;
$left5=("gallery.php?img=$f4&gal=$gallery&name=$t4");
$right5=("gallery.php?img=$f6&gal=$gallery&name=$t6");
$image6=$f6;
$left6=("gallery.php?img=$f5&gal=$gallery&name=$t5");
$right6=("gallery.php?img=$f7&gal=$gallery&name=$t7");
$image7=$f7;
$left7=("gallery.php?img=$f6&gal=$gallery&name=$t6");
$right7=("gallery.php?img=$f8&gal=$gallery&name=$t8");
$image8=$f8;
$left8=("gallery.php?img=$f7&gal=$gallery&name=$t7");
$right8=("gallery.php?img=$f9&gal=$gallery&name=$t9");
$image8=$f9;
$left9=("gallery.php?img=$f8&gal=$gallery&name=$t8");
$right9=("gallery.php?img=$f1&gal=$gallery&name=$t1");
$query1="INSERT INTO $gallery (image, left, right)
VALUES ('".$image1."', '".$left1."', '".$right1."');";
$query2="INSERT INTO $gallery (image, left, right)
VALUES ('".$image2."', '".$left2."', '".$right2."');";
$query3="INSERT INTO $gallery (image, left, right)
VALUES ('".$image3."', '".$left3."', '".$right3."');";
$query4="INSERT INTO $gallery (image, left, right)
VALUES ('".$image4."', '".$left4."', '".$right4."');";
$query5="INSERT INTO $gallery (image, left, right)
VALUES ('".$image5."', '".$left5."', '".$right5."');";
$query6="INSERT INTO $gallery (image, left, right)
VALUES ('".$image6."', '".$left6."', '".$right6."');";
$query7="INSERT INTO $gallery (image, left, right)
VALUES ('".$image7."', '".$left7."', '".$right7."');";
$query8="INSERT INTO $gallery (image, left, right)
VALUES ('".$image8."', '".$left8."', '".$right8."');";
$query9="INSERT INTO $gallery (image, left, right)
VALUES ('".$image9."', '".$left9."', '".$right9."');";
mysql_connect($db_host,$db_user,$db_password) or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());
mysql_query($query1);
mysql_query($query2);
mysql_query($query3);
mysql_query($query4);
mysql_query($query5);
mysql_query($query6);
mysql_query($query7);
mysql_query($query8);
mysql_query($query9);
?>
Now, all of this mumbo-jumbo gives what seems to me like the correct queries. Here is the output echoed on the php page:
INSERT INTO tropics (image, left, right) VALUES ('opera', 'gallery.php?img=bora bora church&gal=tropics&name=Bora Bora Church', 'gallery.php?img=opera_2&gal=tropics&name=Sydney Opera House #2');
INSERT INTO tropics (image, left, right) VALUES ('opera_2', 'gallery.php?img=opera&gal=tropics&name=Sydney Opera House #1', 'gallery.php?img=unsw&gal=tropics&name=New South Wales');
INSERT INTO tropics (image, left, right) VALUES ('unsw', 'gallery.php?img=opera_2&gal=tropics&name=Sydney Opera House #2', 'gallery.php?img=sea_lion&gal=tropics&name=Sea Lion');
INSERT INTO tropics (image, left, right) VALUES ('sea_lion', 'gallery.php?img=unsw&gal=tropics&name=New South Wales', 'gallery.php?img=bondi&gal=tropics&name=Bondi');
INSERT INTO tropics (image, left, right) VALUES ('bondi', 'gallery.php?img=sea_lion&gal=tropics&name=Sea Lion', 'gallery.php?img=borabora_kids&gal=tropics&name=Bora Bora Kids');
INSERT INTO tropics (image, left, right) VALUES ('borabora_kids', 'gallery.php?img=bondi&gal=tropics&name=Bondi', 'gallery.php?img=mexican_kid&gal=tropics&name=Mexican Dude');
INSERT INTO tropics (image, left, right) VALUES ('mexican_kid', 'gallery.php?img=borabora_kids&gal=tropics&name=Bora Bora Kids', 'gallery.php?img=mexican_girl&gal=tropics&name=Mexican Girl');
INSERT INTO tropics (image, left, right) VALUES ('bora bora church', 'gallery.php?img=mexican_kid&gal=tropics&name=Mexican Dude', 'gallery.php?img=bora bora church&gal=tropics&name=Bora Bora Church');
INSERT INTO tropics (image, left, right) VALUES ('', 'gallery.php?img=mexican_girl&gal=tropics&name=Mexican Girl', 'gallery.php?img=opera&gal=tropics&name=Sydney Opera House #1');
Why doesn’t any of this end up in the database!?