Newbie PHP Help with PHP: Echo and IE

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
WillAddison
Forum Newbie
Posts: 2
Joined: Thu Jul 08, 2010 9:55 pm

Newbie PHP Help with PHP: Echo and IE

Post by WillAddison »

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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Newbie PHP Help with PHP: Echo and IE

Post by requinix »

Just to get this straight: PHP and IE have nothing to do with each other. Absolutely nothing.
WillAddison wrote:When this code runs in IE 8, it displays the PHP script only when I click on the submit.
That's the correct behavior, if you were wondering.

If you do a View Source on that page, what do you see? Do you see the PHP code? That means it wasn't being executed. What's different between the phpinfo() page you did and this new one?
WillAddison
Forum Newbie
Posts: 2
Joined: Thu Jul 08, 2010 9:55 pm

Re: Newbie PHP Help with PHP: Echo and IE

Post by WillAddison »

Nevermind, my friend assisted. I was not starting the page from the localhost causing the php not to execute. Thanks....
:oops:
Post Reply