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 Quote
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 Quote
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? Quote
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 Quote
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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
× Pasted as rich text. Paste as plain text instead
Only 75 emoji are allowed.
× Your link has been automatically embedded. Display as a link instead
× Your previous content has been restored. Clear editor
× You cannot paste images directly. Upload or insert images from URL.