So, I changed the code you had provided and that worked. Now,
I've tested
the form and when I click "submit," I get this:
Notice: Undefined index: nmChildren in C:\Program
Files\Apache
Group\Apache2\htdocs\newland\Lesson06\Start\newland-php\tourprice_processor.php
on line 2
Warning: Cannot modify header information - headers already
sent by (output
started at C:\Program Files\Apache
Group\Apache2\htdocs\newland\Lesson06\Start\newland-php\tourprice_processor.php:2)
in C:\Program Files\Apache
Group\Apache2\htdocs\newland\Lesson06\Start\newland-php\tourprice_processor.php
on line 4
I'm guessing it's related to the change I made in
tourprice.php. I tried to
figure out what needed to be changed in
tourprice_processor.php based on
that change, but I'm still pretty new at this and really
wasn't sure.
Below is the code from tourprice_processor.php:
<?php
if (is_numeric($_POST['numAdults']) == false or
is_numeric($_POST['nmChildren']) == false)
{
header("Location: tourprice.php?error=notnumeric");
exit;
}
?>
<?php
$numAdult = $_POST['numAdults'];
$numChild = $_POST['numChildren'];
$basePrice = $_POST['tourName'];
$tourPrice = ($numAdult * $basePrice) + ($numChild *
$basePrice);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<title>Newland Tours: Tour Price
Calculator</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<link href="css/newland.css" rel="stylesheet"
type="text/css" /></head>
<body>
<a href="#top"><img src="images/spacer.gif"
alt="Skip to main page content"
width="1" height="1" border="0" align="left" /></a>
<table width="750" border="0" cellpadding="3"
cellspacing="0">
<tr>
<td><img src="images/banner_left.gif" width="451"
height="68" alt="Newland
Tours Banner, Left." /></td>
<td width="280"><img src="images/banner_right.jpg"
width="276" height="68"
alt="Newland Tour Banner, Right." /></td>
</tr>
<tr>
<td><img src="images/navbar.gif" name="navbar"
width="450" height="20"
border="0" usemap="#navbarMap" alt="Navigation Bar."
/></td>
<td><img name="copyright_bar"
src="images/copyright_bar.gif" width="272"
height="20" border="0" alt="Copyright 2006 Newland Tours."
/></td>
</tr>
<tr>
<td colspan="2">
<h1><br />
<a name="top" id="top"></a>Tour Price
Calculator</h1>
<p>The estimated cost of your tour is
<strong><?php echo
'$'.number_format($tourPrice, 2);
?></strong>.</p>
<p>Prices include hotel, accommodation, and travel
expenses during the
tour. They
do not include airfare to the starting
destination.</p>
<p><a href="tourprice.php">Calculate</a>
another tour.</p>
<p><a href="contact.php">Contact</a> one
of our qualified agents.</p>
</td>
</tr>
</table>
<br />
<map name="navbarMap" id="navbarMap">
<area shape="rect" coords="1,0,62,20" href="index.php"
alt="Home" />
<area shape="rect" coords="71,0,117,20" href="about.php"
alt="About" />
<area shape="rect" coords="129,0,196,20" href="tours.php"
alt="Find Tours"
/>
<area shape="rect" coords="209,0,311,20"
href="profiles.php" alt="Country
Profiles" />
<area shape="rect" coords="327,0,434,20"
href="contact.php" alt="Contact An
Agent" />
</map>
</body>
</html>
--
Heather
"David Powers" <david@example.com> wrote in message
news:e6fhjf$mc5$1@forums.macromedia.com...
> Heather wrote:
>> I inserted the code for the conditional region just
before the opening
>> <form> tag, as the book instructed (Lesson 6).
>>
>> <?
>> if ($_GET['error'] == "notnumeric")
>>
>> When I preview locally, the page appears correctly,
but with the
>> following message before the form:
>>
>> Notice: Undefined index: error in C:\Program
Files\Apache
>
> It's badly written code. It should be
>
> if (isset($_GET['error']) && $_GET['error'] ==
"notnumeric")
>
>> On my remote server, everything works as it should:
>
> That's because your remote server has been configured to
suppress PHP
> notices.
>
> PHP notices alert you to non-fatal mistakes in coding. A
lot of people
> just ignore them, but it's a sloppy habit to get into,
because it can lay
> your scripts open to attack. Before testing the value of
a variable, you
> should always use isset() to check that the variable has
been defined in
> the first place.
>
>
http://www.php.net/manual/en/function.isset.php
>
> --
> David Powers
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
> Author, "Foundation PHP 5 for Flash" (friends of ED)
>
http://foundationphp.com/