Ok...this is my "HELP ME! HELP ME!" thread.:D
I finally got my code to work...almost. The form posts to my database but only the first query data inserts and the last value of the third query. All the form fields are correct and the problem appears to be with my posting script so I'll include just that:
<?php
session_start();
$dbhost = "localhost";
$dbname = "WB_db";
$dbuser = "xxxxx";
$dbpass = "xxxxx";
mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error());
mysql_select_db($dbname) or die("MySQL Error: " . mysql_error());
$guest_1 = $_POST['guest_1'];
$guest_2 = $_POST['guest_2'];
$age_1 = $_POST['age_1'];
$age_2 = $_POST['age_2'];
$country = $_POST['country'];
$region = $_POST['region'];
$email = $_POST['email'];
$hedo2_trips = $_POST['hedo2_trips'];
$hedo3_trips = $_POST['hedo3_trips'];
$jamaica_trips = $_POST['jamaica_trips'];
$hedo2_visits = $_POST['hedo2_visits'];
$hedo3_visits = $_POST['hedo3_visits'];
$jamaica_visits = $_POST['jamaica_visits'];
$return_buncher = $_POST['return_buncher'];
$return_trip = $_POST['return_trip'];
$airline = $_POST['airline'];
$flight_number = $_POST['flight_number'];
$arrival = $_POST['arrival'];
$departure = $_POST['departure'];
$login_1 = $_POST['login_1'];
$login_2 = $_POST['login_2'];
$pass_1 = $_POST['pass_1'];
$pass_2 = $_POST['pass_2'];
$comments = $_POST['comments'];
if(!$_POST['Submit']) {
echo "Please fill out all areas";
header('Location: addme.php');
}else{
mysql_query("INSERT INTO personal_info (`UserID`,`guest_1`, `age_1`, `guest_2`, `age_2`, `country`, `region`, `email`)
VALUES
('NULL','$guest_1','$age_1','$guest_2','$age_2','$country','$region','$email')");
//Second query to execute
mysql_query("INSERT INTO travel_info (``UserID`,`hedo2_trips`,`hedo2_visits`,`hedo3_trips`,`hedo3_visits`,`jamaica_trips`, `jamaica_visits`, `return_buncher`, `return_trip`, `airline`, `flight_number`, `arrival`, `departure`)
VALUES
('NULL','$hedo2_trips','$hedo2_visits','$hedo3_trips','$hedo3_visits','$jamaica_trips','$jamaica_visits','$return_buncher','$return_trip','$airline','$flight_number','$arrival','$departure')");
//Third query needed to execute
mysql_query("INSERT INTO login_info (`UserID`,`login_1`,`pass_1`,`login_2`,`pass_2`,`comments`)
VALUES
('NULL','$login_1','$pass_1','$login_2','$pass_2','$comments')") or die (mysql_error());
echo "Guests have been added!";
header('Location: addme.php');
}
?>
It took me a bit but I finally wrapped my brain around the code I needed to insert my form data. Problem is, due to the constraints of the mySQL database, I was forced to split my database into 3 separate tables (no big deal). Now I have to execute 3 separate queries from the same line of code. From what I've been able to glom off help sites (most notably this one) and tutorials, this is a very difficult task and goes beyond the scope of my skill.
I have tried numerous attacks at this with solutions others have tried and none seems to work for me. Maybe its my syntax or I'm missing something I've probably gone over several hundred times but every time I attempt a solution I am met with errors.
If someone can come up with a solution that works I will put you on my Christmas list.
Remember this (and my previous) thread because one of these days I will be a PHP guru and people will flock from miles around to witness my sage advice...or maybe I'll be able to competently write a few lines of code whenever I need to build a site. ;)