I want one form to submit to 3 different tables in MYSQL... I got them to submit to the right tables, but I want to take the first tables id (primary key, auto_increment) and make that the realtor_id of the other two tables. Anyone know what I need to put in the field of the other 2 to make it read it properly? Heres what I have so far...
- if($_POST['submit'])
-
{
-
-
$sql = "INSERT INTO logins (username, password) VALUES('" . $_POST['usernameBox'] . "', '" . $_POST['passwordBox'] . "');";
-
mysql_query($sql);
-
-
$realtorsql = "INSERT INTO realtors (realtor_id, first_name, last_name, address, city, state, zip, email, phone, cell, fax) VALUES( '" . $sql['id'] . "', '" . $_POST['firstnameBox'] . "', '" . $_POST['lastnameBox'] . "', '" . $_POST['addressBox'] . "', '" . $_POST['cityBox'] . "', '" . $_POST['stateBox'] . "', '" . $_POST['zipBox'] . "', '" . $_POST['emailBox'] . "', '" . $_POST['phoneBox'] . "', '" . $_POST['cellBox'] . "', '" . $_POST['faxBox'] . "');";
-
mysql_query($realtorsql);
-
-
$websitesql = "INSERT INTO realtors_websites (realtor_id, main_title) VALUES('" . $sql['id'] . "', '" . Welcome . "');";
-
mysql_query($websitesql);
-
-
header("Location: " . $config_basedir . "realtorwelcome.php");
-
}
Obviously '" . $sql['id'] . "' doesn't work, what would I use instead? Or should I make the first page just username/ pass and next page it loads up the additional information, but I don't know how to get it to read the new id formed on the next page in that scenario either. Thank you!