Forum Moderators: coopster
In confirm_request.php i have the code:
echo "<form name='form1' method='post' action='confirmed.php'";
echo "<input type='hidden' name='laptopid' value='$laptop_id' id='laptopid'>";
echo "<input type='hidden' name='prismid' value='$prismid' id='prismid'>";
echo "<input type='hidden' name='firstname' value='$firstname' id='firstname'>";
echo "<input type='hidden' name='lastname' value='$lastname' id='lastname'>";
echo "<input type='hidden' name='emailaddress' value='$emailaddress' id='emailaddress'>";
echo "<input type='hidden' name='phone' value='$phone' id='phone'>";
echo "<input type='hidden' name='details' value='$details' id='details'>";
echo "<input type='hidden' name='reason' value='$reason' id='summary'>";
echo "<input type='hidden' name='cod' value='$cod' id='cod'>";
echo "<input type='hidden' name='cid' value='$cid' id='cid'>";
echo "<input type='submit' name='Submit' value='Confirm Request'>";
echo "</form>";
As you can see, this form points at confirmed.php, and sends a variable 'laptopid' whose value comes from $laptop_id earlier in the code. I've tested (on the line right above the form declaration) for the existence of this variable. It exists.
Now, on the receiving side, in confirmed.php, i have:
$prismid = $_POST['prismid'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$emailaddress = $_POST['emailaddress'];
$phone = $_POST['phone'];
$details = $_POST['details'];
$reason = $_POST['reason'];
$cod = $_POST['cod'];
$cid = $_POST['cid'];
$laptop_id = $_POST['laptopid'];
All of these variables function perfectly except $laptop_id. It throws an error Notice: Undefined index: laptopid.
laptop_id is typically a very small integer.
Thank you.
I don't see why it isn't working as you want because it should. I do see a HTML error, however. You are missing the end of the form tag:
echo "<form name='form1' method='post' action='confirmed.php'>";
check your spelling to see if you have anything wrong. You can also view all the post variables by using the following:
echo '<pre>';
print_r($_POST);
echo '</pre>';
If you can't find it here then the form isn't submitting it properly.
good luck
This is also a good example of when validating your pages [validator.w3.org] can help with debugging seemingly-impossible errors. Incorrectly closed HTML elements have bit me many times in the past. :)