hmmm...re-did it from scratch and get the same message.  I've included the
html script from the form as well:
<html>
<head>
  <title>Bob's Auto Parts</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Form</h2>

<form action="processorder2.php" method=post>
<table border=0>
<tr bgcolor=#cccccc>
  <td width=150>Item</td>
  <td width=15>Quantity</td>
</tr>
<tr>
  <td>Tyres</td>
  <td align=center><input type="text" name="tyreqty" size=3
maxlength=3></td>
</tr>
<tr>
  <td>Oil</td>
  <td align=center><input type="text" name="oilqty" size=3 maxlength=3></td>
</tr>
<tr>
  <td>Spark Plugs</td>
  <td align=center><input type="text" name="sparkqty" size=3
maxlength=3></td>
</tr>
<tr>
  <td>How did you find Bob's</td>
  <td><select name="find">
        <option value = "a">I'm a regular customer
        <option value = "b">TV advertising
        <option value = "c">Phone directory
        <option value = "d">Word of mouth
      </select>
  </td>
</tr>
<tr>
  <td colspan=2 align=center><input type=submit value="Submit Order"></td>
</tr>
</table>
</form>

</body>
</html>
                                                AND THE RESULTS PAGE:
<html>
<head>
  <title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?
  $totalqty = 0;
  $totalqty += $tyreqty;
  $totalqty += $oilqty;
  $totalqty += $sparkqty;

  $totalamount = 0.00;

  define("TYREPRICE", 100);
  define("OILPRICE", 10);
  define("SPARKPRICE", 4);

  if( $tyreqty < 10 )
    $discount = 0;
  elseif( $tyreqty >= 10 && $tyreqty <= 49 )
    $discount = 5;
  elseif( $tyreqty >= 50 && $tyreqty <= 99 )
    $discount = 10;
  elseif( $tyreqty > 100 )
    $discount = 15;

  echo "<p>Order processed at ";
  echo date("H:i, jS F");
  echo "<br>";
  echo "<p>Your order is as follows:";
  echo "<br>";

  if( $totalqty == 0 )
  {
    echo "You did not order anything on the previous page!<br>";
  }
  else
  {
    if ( $tyreqty>0 )
      echo $tyreqty." tyres<br>";
    if ( $oilqty>0 )
      echo $oilqty." bottles of oil<br>";
    if ( $sparkqty>0 )
      echo $sparkqty." spark plugs<br>";
  }

  echo "<P>Discount on tyres = ".$discount."%";

  // if version
/*
  if($find == "a")
    echo "<P>Regular customer.";
  elseif($find == "b")
    echo "<P>Customer referred by TV advert.";
  elseif($find == "c")
    echo "<P>Customer referred by phone directory.";
  elseif($find == "d")
    echo "<P>Customer referred by word of mouth.";
*/

  // switch version
  switch($find)
  {
    case "a" :
      echo "<P>Regular customer.";
      break;
    case "b" :
      echo "<P>Customer referred by TV advert.";
      break;
    case "c" :
      echo "<P>Customer referred by phone directory.";
      break;
    case "c" :
      echo "<P>Customer referred by word of mouth.";
      break;
    default :
      echo "<P>We do not know how this customer found us.";
      break;
  }

?>
</body>
</html>


-----Original Message-----
From: Jay Blanchard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 3:22 PM
To: [EMAIL PROTECTED]; 'Php-General@Lists. Php. Net
(E-mail)'
Subject: RE: [PHP] Can't get the example to work


[snip]
echo $tireqty. "tires<br>
[/snip]

$tyreqty

looks like you have a typo

HTH!

Jay

-----Original Message-----
From: Eugene.McQuade [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 2:21 PM
To: 'Jay Blanchard'; 'Php-General@Lists. Php. Net (E-mail)'
Subject: RE: [PHP] Can't get the example to work


the following is the script requested:
<html>
<head>
  <title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?
  $totalqty = 0;
  $totalqty += $tyreqty;
  $totalqty += $oilqty;
  $totalqty += $sparkqty;

  $totalamount = 0.00;

  define("TYREPRICE", 100);
  define("OILPRICE", 10);
  define("SPARKPRICE", 4);

  if( $tyreqty < 10 )
    $discount = 0;
  elseif( $tyreqty >= 10 && $tyreqty <= 49 )
    $discount = 5;
  elseif( $tyreqty >= 50 && $tyreqty <= 99 )
    $discount = 10;
  elseif( $tyreqty > 100 )
    $discount = 15;

  echo "<p>Order processed at ";
  echo date("H:i, jS F");
  echo "<br>";
  echo "<p>Your order is as follows:";
  echo "<br>";

  if( $totalqty == 0 )
  {
    echo "You did not order anything on the previous page!<br>";
  }
  else
  {
    if ( $tyreqty>0 )
      echo $tyreqty." tyres<br>";
    if ( $oilqty>0 )
      echo $oilqty." bottles of oil<br>";
    if ( $sparkqty>0 )
      echo $sparkqty." spark plugs<br>";
  }

  echo "<P>Discount on tyres = ".$discount."%";

  // if version
/*
  if($find == "a")
    echo "<P>Regular customer.";
  elseif($find == "b")
    echo "<P>Customer referred by TV advert.";
  elseif($find == "c")
    echo "<P>Customer referred by phone directory.";
  elseif($find == "d")
    echo "<P>Customer referred by word of mouth.";
*/

  // switch version
  switch($find)
  {
    case "a" :
      echo "<P>Regular customer.";
      break;
    case "b" :
      echo "<P>Customer referred by TV advert.";
      break;
    case "c" :
      echo "<P>Customer referred by phone directory.";
      break;
    case "c" :
      echo "<P>Customer referred by word of mouth.";
      break;
    default :
      echo "<P>We do not know how this customer found us.";
      break;
  }

?>
</body>
</html>

-----Original Message-----
From: Jay Blanchard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 2:54 PM
To: [EMAIL PROTECTED]; 'Php-General@Lists. Php. Net
(E-mail)'
Subject: RE: [PHP] Can't get the example to work


[snip]
However, running the Tutorial scripts found in PHP and MySQL (SAMS), I get,
for example, the following error message for all 3 fields:
Notice: Undefined variable: tireqty in
c:\inetpub\wwwroot\php_tutorial1\processorder2.php on line 11
tires
Here is what is in line 11 is -  echo $tireqty. "tires<br>";
[/snip]

$tireqty is not defined.

[snip]
Any suggestions?
[/snip]


Send more of the code, cannot tell why it is not defined or if you used the
right variable

Jay



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to