Wickham Posted January 20, 2009 Report Posted January 20, 2009 (edited) When I open order.html in IE and fill in the form and click submit, I get a window asking me if I want to open or save process.php You have an error here in the html file; I've added an extra " before post" I think the echo line code is wrong in the process.php file; it raises a php error. Also try renaming as order.php if it still doesn't work. Edited January 20, 2009 by Wickham
rashroyer Posted January 20, 2009 Author Report Posted January 20, 2009 Thank you very much for that advice. Just one more question: How do I open the order.php file in Apache? As you can see, I'm new at this. I appreciate your patience and help! Dick
falkencreative Posted January 20, 2009 Report Posted January 20, 2009 Thank you very much for that advice. Just one more question: How do I open the order.php file in Apache? As you can see, I'm new at this. I appreciate your patience and help! Dick If you want the server to be able to run your PHP code, you have to place it in the correct folder (htdocs) and run it through localhost. Make sense?
rashroyer Posted January 20, 2009 Author Report Posted January 20, 2009 So, I just name all files with the .php extension and save them to the htdocs folder. Then to test the code, I open the main file (order.php, the one that does the posting in the example I cited) by opening my browser and typing in the URL field: localhost/order.php Then order.php should be able to post to process.php and the server will run the php code in that file and return a result to the browser window? I think I've got it. Thanks again for your help! Dick
Wickham Posted January 20, 2009 Report Posted January 20, 2009 This works (minor edits to echo line and I've shown an alternative):- > br />"http://www.w3.org/TR/html4/strict.dtd"> PHP test </pre> <form action="process.php" method="post"> Paint Brushes Quantity: </form> <br><br process.php file:- br />"http://www.w3.org/TR/html4/strict.dtd"> PHP test $quantity = $_POST['quantity']; $item = $_POST['item']; echo "You ordered"." $item"." nr"." $quantity"; echo " You ordered {$item} nr {$quantity}"; ?> Load both files into htdocs folder (or www if using Wamp or WampServer) It shouldn't matter if order.html is order.html or order.php
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now