I'm attempting to get my 'elseif' statement to work. This is straight out of my php book but it doesn't seem to be working. I was also unsuccessful with a straight IF statement. In my example, I'm using two files: one is a simple html table where the user inputs some values (think order form); the second is the .php file that takes the input values from the html pg and makes a confirmation page from the order. See below for both scripts. the elseif statement is at the very end of the #2 script block:
#1
<html>
<form action="processorder.php" method=post>
<table width="323" border=0>
<!--DWLayoutTable-->
<tr bgcolor=#cccccc>
<td width=148 height="21" bgcolor="#FF6600"><strong>Item</strong></td>
<td width=142 bgcolor="#999999"><strong>Quantity</strong></td>
</tr>
<tr>
<td height="24" bgcolor="#FF6600"><strong>Tires</strong></td>
<td align=center bgcolor="#CCCCCC"> <input type="text" name="tireqty" size=3 maxlength=3></td>
</tr>
<tr>
<td height="24" bgcolor="#FF6600"><strong>Oil</strong></td>
<td align=center bgcolor="#CCCCCC"> <input type="text" name="oilqty" size=3 maxlength=3></td>
</tr>
<tr>
<td height="24" bgcolor="#FF6600"><strong>Spark Plugs</strong></td>
<td align=center bgcolor="#CCCCCC"><strong>
<input name="sparkqty" type="text" value="" size="3">
</strong></td>
</tr>
<tr>
<td height="26" bgcolor="#FF6600"><strong>How did you find Bob's</strong></td>
<td bgcolor="#CCCCCC"><select name="find">
<option value="a">I'm a regular customer
<option value="b">TV Advertisement
<option value="c">Newspaper Ad
<option value="d">Friend </select></td>
</tr>
<tr bgcolor="#CCCCCC">
<td height="21" valign="top"><!--DWLayoutEmptyCell--> </td>
<td> </td>
</tr>
<tr>
<td height="26" colspan=2 align=center valign="top" bgcolor="#CCCCCC"> <input type=submit value="submit Order"></td>
</tr>
</table>
</form>
</html>
#2 (php)
<html>
<head>
<title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?php
echo "<p> Order Processed at ";
echo date("H:i, jS of F");
echo "<br>";
echo "<p> Your Order is as follows:";
echo "<br>";
echo $tireqty." tires<br>";
echo $oilqty." bottles of oil<br>";
echo $sparkqty." spark plugs<br>";
$totalqty=0;
$totalamount=0.00;
define("TIREPRICE", 100);
define("OILPRICE", 10);
define("SPARKPRICE", 4);
$totalqty=$tireqty+$oilqty+$sparkqty;
$totalamount=$tireqtyTIREPRICE
+$oilqtyOILPRICE
+$sparkqty*SPARKPRICE;
$totalmount=number_format($totalamount, 2);
echo "<br>\n";
echo "Items ordered: ".$totalqty."<br>\n";
echo "Subtotal: $".$totalamount."<br>\n";
$taxrate=0.10; //local sales tax is 10%
$totalamount=$totalamount*(1+$taxrate);
$totalamount=number_format($totalamount, 2);
echo "Total including tax: $".$totalamount."<br>\n"
if($find=="a")
echo "<p> Regular Customer.</p>";
elseif($find=="b")
echo "<p> Customer referred by TV advertisement.</p>";
elseif($find=="c")
echo "<p> Customer referred by phone directory.</p>";
elseif($find=="d")
echo "<p> Customer referred by word of mouth.</p>";
?>
</body>
</html>
any help would be great. i would retain more of the php book if my examples actually worked. i hate to just read about it and not "do it". if you know what i mean.
Thanks!