This example is the very first one from the book PHP and MYSQL Web Development. Sams. ISBN: 0-672-31784-2.
I'm included 4 instances below. 1, 2 and 4 are code. #3 is text from the browser.
The problem I'm experiencing is that the PHP is NOT being executed. I've got PHP 4.2.3 and MySQL 3.23 installed fine (Windows XP, Apache 1.3.26)
phpinfo() shows short_open_tag is on in both the LOCAL and MASTER environments.
I can't figure out why this code is malfunctioning. I've tried using the <?php ... ?> tag style, but still the same broken results.
I should add that other stock examples, straight from the accompanying CD are also displaying code in inappropriate places.
Here are the installation instructions that I used when installing PHP: http://sherwinm.com/tek/tutorials/display_tut.php?tut_id=2
Here are the lines that I've added to Apache's HTTPD.conf file:
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
Action application/x-httpd-php "/php/php.exe "
LoadModule php4_module c:/php/sapi/php4apache.dll
AddModule mod_php4.c
-- [1] This is the order form code [ FILENAME: orderform.html ]--
<html>
<head>
<title>Bob's Auto Parts</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Form</h2>
<form action="processorder.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 colspan=2 align=center><input type=submit value="Submit Order"></td>
</tr>
</table>
</form>
</body>
</html>
-- [2] This is the order processor code [ FILENAME: processorder.php ]--
<HTML>
<HEAD>
<TITLE> Bob's Auto Parts - Order Results </TITLE>
</HEAD>
<BODY>
<H1>Bob's Auto Parts</H1>
<H2>Order Results</H2>
<?
echo "<p>Order Processed.";
?>
</BODY>
</HTML>
-- [3] This is the resulting page after clicking SUBMIT on the order form. Note that the contents of the ECHO command are not being displayed--
"Bob's Auto Parts"
"Order Results"
-- [4] This is the source for the resulting page. Note that my PHP code is being shown to me. This should NOT be visible.--
<HTML>
<HEAD>
<TITLE> Bob's Auto Parts - Order Results </TITLE>
</HEAD>
<BODY>
<H1>Bob's Auto Parts</H1>
<H2>Order Results</H2>
<?
echo "<p>Order Processed.";
?>
</BODY>
</HTML>