geekette Posted May 21, 2009 Share Posted May 21, 2009 So I have a project due tomorrow, and for some reason, I can't get it to work. The html portion works, so I'll just paste it below as reference. Unfortunately, the php part is not working. When I run it, it does not render properly. Also, if I were to create a field where someone can input their email address, and they should receive an email confirmation, how would I go about doing so? I previously had code that would do that, unfortunately, it didn't work, so I deleted that. Php is the last one. Thanks in advance for any help! here's the html page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title> Princess Cupcakes </title> </head> <body> <link rel="stylesheet" href="phpcssstyle.css" type="text/css" /> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <h1>Princess Cupcakes<h1 /> <hr> <hr /> <h2>Warming hearts one cupcake at a time.</h2> <br> <h3>All cupcakes are $2.50 each unless otherwise noted. Please allow at least 20 minutes between order and pickup time.</h3> <br /> <hr> <hr /> <ul><b> <li>Pink Princess: Strawberry cupcake with a strawberry whipped cream frosting <li> Swan Princess: Vanilla cupcake with lemon buttercream frosting <li>Prince Charming: Chocolate cupcake with a raspberry buttercream frosting <li>Royal Crown: Red velvet cupcake with cheesecake frosting <li>The Nutty Jester: Nutella filled cupcake, with a nutella buttercream frosting <li>Pumpkin Carriage: Pumpkin cupcake with a pumpkin whipped cream frosting <li>Princess Diaries: Blueberry cupcake with blueberry whipped cream frosting <li>Tropical Princess: Mango and banana cupcake with a strawberry whipped cream frosting <li>Career Princess: Vanilla cake with dark chocolate buttercream frosting </b> <br> <br> <br /> <h3>Order your cupcakes here. For quantities over 5 per type of cupcake, please call us: <form action="ReviewOrder.php" method="get"> <p><b>Pink Princess</b></p> <p><input type="radio" name="pp" value="0" />Zero<br /> <input type="radio" name="pp" value="1" />One<br /> <input type="radio" name="pp" value="2" />Two <br /> <input type="radio" name="pp" value="3" />Three<br /> <input type="radio" name="pp" value="4" />Four<br /> <input type="radio" name="pp" value="5" />Five</p> <br> <p><b>Swan Princess</b></p> <p><input type="radio" name="sp" value="0" />Zero<br /> <input type="radio" name="sp" value="1" />One<br /> <input type="radio" name="sp" value="2" />Two<br /> <input type="radio" name="sp" value="3" />Three<br /> <input type="radio" name="sp" value="4" />Four<br /> <input type="radio" name="sp" value="5" />Five</p> <br> <p><b>Prince Charming</b></p> <p><input type="radio" name="pc" value="0" />Zero<br /> <input type="radio" name="pc" value="1" />One<br /> <input type="radio" name="pc" value="2" />Two<br /> <input type="radio" name="pc" value="3" />Three<br /> <input type="radio" name="pc" value="4" />Four<br /> <input type="radio" name="pc" value="5" />Five</p> <br> <p><b>Royal Crown</b></p> <p><input type="radio" name="rc" value="0" />Zero<br /> <input type="radio" name="rc" value="1" />One<br /> <input type="radio" name="rc" value="2" />Two<br /> <input type="radio" name="rc" value="3" />Three<br /> <input type="radio" name="rc" value="4" />Four<br /> <input type="radio" name="rc" value="5" />Five</p> <br> <p><b>The Nutty Jester</b></p> <p><input type="radio" name="nj" value="0" />Zero<br /> <input type="radio" name="nj" value="1" />One<br /> <input type="radio" name="nj" value="2" />Two<br /> <input type="radio" name="nj" value="3" />Three<br /> <input type="radio" name="nj" value="4" />Four<br /> <input type="radio" name="nj" value="5" />Five</p> <br> <p><b>Pumpkin Carriage</b></p> <p><input type="radio" name="pkc" value="0" />Zero<br /> <input type="radio" name="pkc" value="1" />One<br /> <input type="radio" name="pkc" value="2" />Two<br /> <input type="radio" name="pkc" value="3" />Three<br /> <input type="radio" name="pkc" value="4" />Four<br /> <input type="radio" name="pkc" value="5" />Five</p> <br> <p><b>Princess Diaries</b></p> <p><input type="radio" name="pd" value="0" />Zero<br /> <input type="radio" name="pd" value="1" />One<br /> <input type="radio" name="pd" value="2" />Two<br /> <input type="radio" name="pd" value="3" />Three<br /> <input type="radio" name="pd" value="4" />Four<br /> <input type="radio" name="pd" value="5" />Five</p> <br> <p><b>Tropical Princess</b></p> <p><input type="radio" name="tp" value="0" />Zero<br /> <input type="radio" name="tp" value="1" />One<br /> <input type="radio" name="tp" value="2" />Two<br /> <input type="radio" name="tp" value="3" />Three<br /> <input type="radio" name="tp" value="4" />Four<br /> <input type="radio" name="tp" value="5" />Five</p> <br> <p><b>Career Princess</b></p> <p><input type="radio" name="cp" value="0" />Zero<br /> <input type="radio" name="cp" value="1" />One<br /> <input type="radio" name="cp" value="2" />Two<br /> <input type="radio" name="cp" value="3" />Three<br /> <input type="radio" name="cp" value="4" />Four<br /> <input type="radio" name="cp" value="5" />Five</p> <br> <br> <p><input type="submit" value="OK" /></p> </form> <body /> <html /> here's the css: body { color: white; background: pink; margin-bottom: 6ex; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } h1 { color: #039; background: pink; margin-bottom: 2ex; } h2, h3, h4, h5, h6 { color: #039; } table { margin-right: auto; margin-bottom: 2ex; } thead td, th { color: black; background: #cccccc; font-size: smaller; font-weight: bold; text-align: center; padding: 0.5em 1ex; border: 1pt solid gray; } tbody td, td { color: black; background: #eeeeee; font-size: small; padding: 0.5em 1ex; border: 1pt solid gray; } pre { color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } and here's what's been giving me trouble...the php portion of it: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Review Order</title> </head> <body> <link rel="stylesheet" href="phpcssstyle.css" type="text/css" /> <h1>Review Order</h1> <?php function reviewpp ( ) { echo "<p>Pink Princess: ", $_GET [ "pp" ]; if ($_GET["pp"] == "0") echo " (Zero)</p>"; if ($_GET["pp"] == "1") echo " (One)</p>"; if ($_GET["pp"] == "2") echo " (Two)</p>"; if ($_GET["pp"] == "3") echo " (Three)</p>"; if ($_GET["pp"] == "4") echo " (Four)</p>"; if ($_GET["pp"] == "5") echo " (Five)</p>"; } function reviewsp ( ) { echo "<p>Swan Princess: ", $_GET [ "sp" ]; if ($_GET["sp"] == "0") echo " (Zero)</p>"; if ($_GET["sp"] == "1") echo " (One)</p>"; if ($_GET["sp"] == "2") echo " (Two)</p>"; if ($_GET["sp"] == "3") echo " (Three)</p>"; if ($_GET["sp"] == "4") echo " (Four)</p>"; if ($_GET["sp"] == "5") echo " (Five)</p>"; } function reviewpc ( ) { echo "<p>Prince Charming: ", $_GET [ "pc" ]; if ($_GET["pc"] == "0") echo " (Zero)</p>"; if ($_GET["pc"] == "1") echo " (One)</p>"; if ($_GET["pc"] == "2") echo " (Two)</p>"; if ($_GET["pc"] == "3") echo " (Three)</p>"; if ($_GET["pc"] == "4") echo " (Four)</p>"; if ($_GET["pc"] == "5") echo " (Five)</p>"; } function reviewrc ( ) { echo "<p>Royal Crown: ", $_GET [ "rc" ]; if ($_GET["rc"] == "0") echo " (Zero)</p>"; if ($_GET["rc"] == "1") echo " (One)</p>"; if ($_GET["rc"] == "2") echo " (Two)</p>"; if ($_GET["rc"] == "3") echo " (Three)</p>"; if ($_GET["rc"] == "4") echo " (Four)</p>"; if ($_GET["rc"] == "5") echo " (Five)</p>"; } function reviewnj ( ) { echo "<p>The Nutty Jester: ", $_GET [ "nj" ]; if ($_GET["nj"] == "0") echo " (Zero)</p>"; if ($_GET["nj"] == "1") echo " (One)</p>"; if ($_GET["nj"] == "2") echo " (Two)</p>"; if ($_GET["nj"] == "3") echo " (Three)</p>"; if ($_GET["nj"] == "4") echo " (Four)</p>"; if ($_GET["nj"] == "5") echo " (Five)</p>"; } function reviewpkc ( ) { echo "<p>Pumpkin Carriage: ", $_GET [ "pkc" ]; if ($_GET["pkc"] == "0") echo " (Zero)</p>"; if ($_GET["pkc"] == "1") echo " (One)</p>"; if ($_GET["pkc"] == "2") echo " (Two)</p>"; if ($_GET["pkc"] == "3") echo " (Three)</p>"; if ($_GET["pkc"] == "4") echo " (Four)</p>"; if ($_GET["pkc"] == "5") echo " (Five)</p>"; } function reviewpd ( ) { echo "<p>Princess Diaries: ", $_GET [ "pd" ]; if ($_GET["pd"] == "0") echo " (Zero)</p>"; if ($_GET["pd"] == "1") echo " (One)</p>"; if ($_GET["pd"] == "2") echo " (Two)</p>"; if ($_GET["pd"] == "3") echo " (Three)</p>"; if ($_GET["pd"] == "4") echo " (Four)</p>"; if ($_GET["pd"] == "5") echo " (Five)</p>"; } function reviewtp ( ) { echo "<p>Tropical Princess: ", $_GET [ "tp" ]; if ($_GET["tp"] == "0") echo " (Zero)</p>"; if ($_GET["tp"] == "1") echo " (One)</p>"; if ($_GET["tp"] == "2") echo " (Two)</p>"; if ($_GET["tp"] == "3") echo " (Three)</p>"; if ($_GET["tp"] == "4") echo " (Four)</p>"; if ($_GET["tp"] == "5") echo " (Five)</p>"; } function reviewcp ( ) { echo "<p>Career Princess: ", $_GET [ "cp" ]; if ($_GET["cp"] == "0") echo " (Zero)</p>"; if ($_GET["cp"] == "1") echo " (One)</p>"; if ($_GET["cp"] == "2") echo " (Two)</p>"; if ($_GET["cp"] == "3") echo " (Three)</p>"; if ($_GET["cp"] == "4") echo " (Four)</p>"; if ($_GET["cp"] == "5") echo " (Five)</p>"; } reviewpp ( ); reviewsp ( ); reviewpc ( ); reviewrc( ); reviewnj ( ); reviewpkc ( ); reviewpd ( ); reviewtp ( ); reviewcp ( ); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/159147-solved-need-help-asap/ Share on other sites More sharing options...
jsschmitt Posted May 21, 2009 Share Posted May 21, 2009 What is the issue that you are having? http://anomymage.com/tests/do/phpfreaks/ Works fine there ^.^ Quote Link to comment https://forums.phpfreaks.com/topic/159147-solved-need-help-asap/#findComment-839313 Share on other sites More sharing options...
geekette Posted May 21, 2009 Author Share Posted May 21, 2009 This is what it looks like on my browser: Review Order Pink Princess: ", $_GET [ "pp" ]; if ($_GET["pp"] == "0") echo " (Zero)"; if ($_GET["pp"] == "1") echo " (One)"; if ($_GET["pp"] == "2") echo " (Two)"; if ($_GET["pp"] == "3") echo " (Three)"; if ($_GET["pp"] == "4") echo " (Four)"; if ($_GET["pp"] == "5") echo " (Five)"; } function reviewsp ( ) { echo " Swan Princess: ", $_GET [ "sp" ]; if ($_GET["sp"] == "0") echo " (Zero) "; if ($_GET["sp"] == "1") echo " (One)"; if ($_GET["sp"] == "2") echo " (Two)"; if ($_GET["sp"] == "3") echo " (Three)"; if ($_GET["sp"] == "4") echo " (Four)"; if ($_GET["sp"] == "5") echo " (Five)"; } function reviewpc ( ) { echo " Prince Charming: ", $_GET [ "pc" ]; if ($_GET["pc"] == "0") echo " (Zero) "; if ($_GET["pc"] == "1") echo " (One)"; if ($_GET["pc"] == "2") echo " (Two)"; if ($_GET["pc"] == "3") echo " (Three)"; if ($_GET["pc"] == "4") echo " (Four)"; if ($_GET["pc"] == "5") echo " (Five)"; } function reviewrc ( ) { echo " Royal Crown: ", $_GET [ "rc" ]; if ($_GET["rc"] == "0") echo " (Zero) "; if ($_GET["rc"] == "1") echo " (One)"; if ($_GET["rc"] == "2") echo " (Two)"; if ($_GET["rc"] == "3") echo " (Three)"; if ($_GET["rc"] == "4") echo " (Four)"; if ($_GET["rc"] == "5") echo " (Five)"; } function reviewnj ( ) { echo " The Nutty Jester: ", $_GET [ "nj" ]; if ($_GET["nj"] == "0") echo " (Zero) "; if ($_GET["nj"] == "1") echo " (One)"; if ($_GET["nj"] == "2") echo " (Two)"; if ($_GET["nj"] == "3") echo " (Three)"; if ($_GET["nj"] == "4") echo " (Four)"; if ($_GET["nj"] == "5") echo " (Five)"; } function reviewpkc ( ) { echo " Pumpkin Carriage: ", $_GET [ "pkc" ]; if ($_GET["pkc"] == "0") echo " (Zero) "; if ($_GET["pkc"] == "1") echo " (One)"; if ($_GET["pkc"] == "2") echo " (Two)"; if ($_GET["pkc"] == "3") echo " (Three)"; if ($_GET["pkc"] == "4") echo " (Four)"; if ($_GET["pkc"] == "5") echo " (Five)"; } function reviewpd ( ) { echo " Princess Diaries: ", $_GET [ "pd" ]; if ($_GET["pd"] == "0") echo " (Zero) "; if ($_GET["pd"] == "1") echo " (One)"; if ($_GET["pd"] == "2") echo " (Two)"; if ($_GET["pd"] == "3") echo " (Three)"; if ($_GET["pd"] == "4") echo " (Four)"; if ($_GET["pd"] == "5") echo " (Five)"; } function reviewtp ( ) { echo " Tropical Princess: ", $_GET [ "tp" ]; if ($_GET["tp"] == "0") echo " (Zero) "; if ($_GET["tp"] == "1") echo " (One)"; if ($_GET["tp"] == "2") echo " (Two)"; if ($_GET["tp"] == "3") echo " (Three)"; if ($_GET["tp"] == "4") echo " (Four)"; if ($_GET["tp"] == "5") echo " (Five)"; } function reviewcp ( ) { echo " Career Princess: ", $_GET [ "cp" ]; if ($_GET["cp"] == "0") echo " (Zero) "; if ($_GET["cp"] == "1") echo " (One)"; if ($_GET["cp"] == "2") echo " (Two)"; if ($_GET["cp"] == "3") echo " (Three)"; if ($_GET["cp"] == "4") echo " (Four)"; if ($_GET["cp"] == "5") echo " (Five)"; } reviewpp ( ); reviewsp ( ); reviewpc ( ); reviewrc( ); reviewnj ( ); reviewpkc ( ); reviewpd ( ); reviewtp ( ); reviewcp ( ); ?> Quote Link to comment https://forums.phpfreaks.com/topic/159147-solved-need-help-asap/#findComment-839320 Share on other sites More sharing options...
geekette Posted May 21, 2009 Author Share Posted May 21, 2009 actually you know what?...i think i figured it out... Quote Link to comment https://forums.phpfreaks.com/topic/159147-solved-need-help-asap/#findComment-839322 Share on other sites More sharing options...
jsschmitt Posted May 21, 2009 Share Posted May 21, 2009 Are you running the file directly from the hard-drive, or uploaded to a server? If running from the hard-drive, PHP will show up as strings unless you have it installed on your local machine. Quote Link to comment https://forums.phpfreaks.com/topic/159147-solved-need-help-asap/#findComment-839324 Share on other sites More sharing options...
geekette Posted May 21, 2009 Author Share Posted May 21, 2009 Nevermind, I did not figure it out. I thought it was because I didn't have xampp running, but I do. I'm running this from my hard drive, but I do have php installed Quote Link to comment https://forums.phpfreaks.com/topic/159147-solved-need-help-asap/#findComment-839327 Share on other sites More sharing options...
jsschmitt Posted May 21, 2009 Share Posted May 21, 2009 That explains it... I had a buddy do the same thing... he never figured it out and scrapped the project... Good luck with the homework ^.^ Quote Link to comment https://forums.phpfreaks.com/topic/159147-solved-need-help-asap/#findComment-839331 Share on other sites More sharing options...
jsschmitt Posted May 21, 2009 Share Posted May 21, 2009 That explains it... I had a buddy do the same thing... he never figured it out and scrapped the project... Good luck with the homework ^.^ Hmm... ignore what i wrote. You have PHP installed locally, and it is still not working... It looks like it is breaking at the first echo...<?php function reviewpp ( ) { echo "<p>Pink Princess: ", $_GET [ "pp" ]; Make sure you don't have an extra " Quote Link to comment https://forums.phpfreaks.com/topic/159147-solved-need-help-asap/#findComment-839360 Share on other sites More sharing options...
geekette Posted May 21, 2009 Author Share Posted May 21, 2009 I don't think I have an extra " i just looked through it...i hate it when my programs don't render correctly! Quote Link to comment https://forums.phpfreaks.com/topic/159147-solved-need-help-asap/#findComment-839419 Share on other sites More sharing options...
geekette Posted May 21, 2009 Author Share Posted May 21, 2009 a friend just ran it..works fine on his computer and shows up like so: http://obsidian.stanford.edu/samihah/ReviewOrder.php?pp=1&sp=2&pc=2&rc=4&nj=0&pkc=1&pd=0&tp=5&cp=3 unfortunately, it doesn't look like that for me. Does anyone know how to connect a <form> input field to php so that once someone enters their email address, an email will automatically be sent to them confirming their order? Quote Link to comment https://forums.phpfreaks.com/topic/159147-solved-need-help-asap/#findComment-839439 Share on other sites More sharing options...
geekette Posted May 21, 2009 Author Share Posted May 21, 2009 Yayy!! I figured it out! The reason why it wasn't working was because I wasn't opening the file through localhost i hate when little things like that can affect how a program is run. Quote Link to comment https://forums.phpfreaks.com/topic/159147-solved-need-help-asap/#findComment-839473 Share on other sites More sharing options...
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.