I am still learning MySQL. I am using the code below to submit to a database. The form at the bottom submits to a comment page where where a page id which is linked to the ID of each entry. How would I go about getting the ID of the data entered during submission. Keep in mind multiple people may submit at the same time so it cant be based off of last entry to database. Thanks for any help.
Code:
<?php
$business = strip_tags($_POST['business']);
$owner = strip_tags($_POST['owner']);
$address = strip_tags($_POST['address']);
$city = strip_tags($_POST['city']);
$state = strip_tags($_POST['state']);
$zip = strip_tags($_POST['zip']);
$phone = strip_tags($_POST['phone']);
$db_server = "localhost";
$db_name = "******";
$db_user = "******";
$db_pass = "******";
$con = mysql_connect($db_server, $db_user, $db_pass) or die(mysql_error());
mysql_select_db($db_name, $con);
$sql = "INSERT INTO landlords (business, owner, address, city, state, zip, phone)
VALUES ('".$business."','".$owner."', '".$address."', '".$city."', '".$state."', '".$zip."', '".$phone."')";
$result = mysql_query($sql);
if(!$result){
return ("<p>SQL Error<br />".$sql."<br />".mysql_error()."</p>");
}
?>
<form name="add_comment" method="post" action="add_comment.php" target="formtarget">
<input type="hidden" name="business" id="business" value="<?php echo $business;?>" />
<input type="hidden" name="owner" id="owner" value="<?php echo $owner;?>" />
<input type="hidden" name="address" id="address" value="<?php echo $address;?>"/>
<input type="hidden" name="city" id="city" value="<?php echo $city;?>"/>
<input type="hidden" name="state" id="state" value="<?php echo $state;?>"/>
<input type="hidden" name="zip" id="zip" value="<?php echo $zip;?>"/>
<input type="hidden" name="phone" id="phone" value="<?php echo $phone;?>"/>
<input type="hidden" name="page_id" id="page_id" value="<?php echo $page_id;?>"/>
<input type="submit" name="submit" id="submit" />
</form>