Code not displaying properly

Brand new user here, trying to learn out of a book "PHP & MySQL Web Development".

It has you open their prebuilt html file (off the cd) with your browser and you then enter the number of product you purchased (in this case tires/sparkplugs&oil). when you click on the "Submit Order" button it calls this script that I've written by the books instruction:

echo '<p>Your order is as follow: </p>';echo $tireqty.' tires<br />';echo $oilqty.' bottles of oil<br />';echo $sparkqty.' spark plugs<br />';[!--colorc--][/span][!--/colorc--]It's supposed to say the date your order is and the amounts you ordered, like this:

Any idea why? I'm on a PCBSD machine using their PAMP package which contains Apache 2.2.0, MySQL 5.0.18 and PHP 5.1.2. I'm using Quanta Plus to write/edit the script. I've used Firefox and Opera to open this and get the same result both times. Hope this is clear enough, thanks in advance.

the server will not parse your script unless it recognizes the file as a php file.

unless you set the mime type .htm or .html to be processed as php, it will dump out your script as if it were plain old text.

change your file name to blah.php

Did I help you? Feeling generous?Buy me lunch!Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community

thanks for the reply. The prebuilt file is named "orderform.html", the script I wrote following the book is named "processorder.php" The "processorder.php" is the one displaying incorrectly. That's named correctly isn't it?

You said you was running the code of the CD with a browser. Then that will be your problem. You cannot run php code within a web browser as it doesnt understand PHP code. A web browser only understands HTML, CSS and Javascript coding lanagages.

Now in order to run your php file you need to install a server on to your PC. You can do this easily by installing a software package called WAMP. You can WAMP get [a href=\"http://www.wampserver.com/en/index.php\" target=\"_blank\"]here[/a]. It is free to download and use. Once that is installed open up your browser and type in [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a]

Now copy all the php files from the CD to the folder where you have to store your PHP files to be seen by the Apache server. Which I believe is something along the lines of C:\program files\Apache Group\Apache 2\htdocs

Now when you go to [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a] again you should see you php files now just click on the php file you want to run. WAMP should now parse your PHP files and an output should be displayed in the web browser.