Newbie PHP Help with PHP: Echo and IE
Posted: Thu Jul 08, 2010 10:39 pm
I am working with "PHP and MySQL Web Development Fourth Edition" book. I was able to install PHP, Apache and get a test PHP script using <? phpinfo(); ?> and get the display info to work.
I tried to use the first example from the book and am getting some errors.
I am using the following HTML:
<html>
<title>Bob's Autoparts</title>
<body>
<form action="processorder.php" method="post" />
<table border="0">
<trbgcolor="#cccccc">
<td width="150">Item</td>
<td width="15">Quantity</td>
</tr>
<tr>
<td>Tires</td>
<td align="center"><input type="text" name="tireqty" 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 colspan="2" align="center"><input type="submit" value="Submit Order" /></td>
</tr>
</table>
</form>
</body>
</html>
The php code is as follows:
<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.</p>";
?>
</body>
</html>
When this code runs in IE 8, it displays the PHP script only when I click on the submit. In Firefox, the code displays the following:
Bob's Auto Parts
Order Results
Order processed.
"; ?php>
Is there something causing IE to not process the code at all? What is causing the extra "; ?php> at the end?
Thanks,
Will
I tried to use the first example from the book and am getting some errors.
I am using the following HTML:
<html>
<title>Bob's Autoparts</title>
<body>
<form action="processorder.php" method="post" />
<table border="0">
<trbgcolor="#cccccc">
<td width="150">Item</td>
<td width="15">Quantity</td>
</tr>
<tr>
<td>Tires</td>
<td align="center"><input type="text" name="tireqty" 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 colspan="2" align="center"><input type="submit" value="Submit Order" /></td>
</tr>
</table>
</form>
</body>
</html>
The php code is as follows:
<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.</p>";
?>
</body>
</html>
When this code runs in IE 8, it displays the PHP script only when I click on the submit. In Firefox, the code displays the following:
Bob's Auto Parts
Order Results
Order processed.
"; ?php>
Is there something causing IE to not process the code at all? What is causing the extra "; ?php> at the end?
Thanks,
Will