Hi,

I picked up a php book called PHP and MySQL Web Development, and I'm currently stuck trying to figure out why my if, elseif, and else commands are not working.

The problem is that even if I select a different option from the drop down menu I have, it ALWAYS selects the "else" echo.

PHP Code:
if($find == 'a')
    echo 
'<p>Regular customer.</p>';
elseif(
$find == 'b')
    echo 
'<p>Customer referred by TV advert.</p>';
elseif(
$find == 'c')
    echo 
'<p>Customer reffered by phone directory.</p>';
elseif(
$find == 'd')
    echo 
'<p>Customer reffered by word of mouth.</p>';
else
    echo 
'<p>We do not know how this customer found us.</p>'
My drop down menu names are labeled a, b, c, d. And like I said the else echo always shows in my html even if I select another option like B for example.

I was also trying to do a basic code to inform the customer that they did not insert any information into the fields.

PHP Code:
if($totalqty == 0)
  echo 
'You did not order anything on the previous page! <br>'
Again, the same problem persist. The echo comes up even if the customer did put information in the text fields.


Here is the full php file:

PHP Code:
<?php
// Create short varial names
$tireqty $_POST['tireqty'];
$oilqty $_POST['oilqty'];
$sparkqty $_POST['sparkqty'];
define('TIREPRICE'100);
define('OILPRICE'10);
define('SPARKPRICE'4);
?>

<html>
<head>
<title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>

<p>Your order is as follows:</p>

<?php

echo $tireqty' tires<br>';
echo 
$oilqty' bottles of oil<br>';
echo 
$sparkqty' spark plugs<br>';

$totalqty 0;
$totalamount 0.00;

if(
$find == 'a')
    echo 
'<p>Regular customer.</p>';
elseif(
$find == 'b')
    echo 
'<p>Customer referred by TV advert.</p>';
elseif(
$find == 'c')
    echo 
'<p>Customer reffered by phone directory.</p>';
elseif(
$find == 'd')
    echo 
'<p>Customer reffered by word of mouth.</p>';
else
    echo 
'<p>We do not know how this customer found us.</p>';

//Order time

echo '<p>Order processed at ';
echo 
date('H:i, jS F');
echo 
'</p>';
echo 
TIREPRICE;
echo 
'<br>';
echo 
OILPRICE;
echo 
'<br>';
echo 
SPARKPRICE;
echo 
'<br>';

$totalamount $tireqty TIREPRICE
         
$oilqty OILPRICE
         
$sparkqty SPARKPRICE;

echo 
'Subtotal: $'.number_format($totalamount2).' <br>';

$taxrate 0.10// local sales taxt 10%
$totalamount $totalamount * ($taxrate);
echo 
'Total: $'.number_format($totalamount2). '<br>';

?>

</body>
</html>

I'm not sure what I'm doing wrong. Thank you.