Ik ben bezig met een Training From The Source boek: Dreamweaver MX 2004 with ASP, Coldfusion and PHP.
Ik krijg de volgende melding toen ik de 'server-side form validation' gemaakt had:
Notice: Undefined index: error in C:\Server\Apache2\htdocs\newland\tourprice.php
Dit is de code van tourprice.php:
<?php
if ($_GET['error'] == "notnumeric")
{
echo "<p class=\"error\">***Error! One or more fields was left blank or contained a non-numeric character.</p>";
}
?>
En dit is de code van tourprice_processor.php
<?php
if (is_numeric($_POST['numAdults']) == false or is_numeric ($_POST['numChildren']) == false)
{
header("Location:tourprice.php?error=notnumeric");
exit;
}
?>
<?php
$numAdult = $_POST['numAdults'];
$numChild = $_POST['numChildren'];
$basePrice = $_POST['tourName'];
$tourPrice = ($numAdult * $basePrice) + ($numChild * $basePrice);
?>
Ik heb Dreamweaver MX 2004 met PHP 5 en Apache.
Wat heb ik fout gedaan? Ik heb precies uitgevoerd wat in het boek staat en de correcte tourprice.php file, die bij het boek geleverd is geeft dezelfde notice.
458 views