deemurphy Posted June 15, 2005 Share Posted June 15, 2005 I am not getting variables from one script to another. If I could send these files to someone or post them on this site can someone try it on their system and tell me what is wrong. I would like to be able to pass variables from one script to another script. Thanks Dee Quote Link to comment https://forums.phpfreaks.com/topic/2356-forms-using-post-andor-get-statements/ Share on other sites More sharing options...
Matt B. Posted June 16, 2005 Share Posted June 16, 2005 I'll give it a try. Just post the file on the forums and i'll copy/paste it into my Dreamweaver and take a look at it. (Just being a little carefull. Downloading scripts can be dangerous, not to say that you would do that) Quote Link to comment https://forums.phpfreaks.com/topic/2356-forms-using-post-andor-get-statements/#findComment-7739 Share on other sites More sharing options...
deemurphy Posted June 16, 2005 Author Share Posted June 16, 2005 I'll give it a try. Just post the file on the forums and i'll copy/paste it into my Dreamweaver and take a look at it. (Just being a little carefull. Downloading scripts can be dangerous, not to say that you would do that) 242902[/snapback] Thanks Matt. Here is the code to the first script. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Products</title> </head> <body> <img src="http://images.google.com/images?q=tbn:eMqGzBOAocEJ:www.wedowed.com/gc187.jpg"> <form action="newproducts.php" method="post"> <Strong>Select A Product</Strong><br> <select name="name[]" multiple> <option value="Baseball Bat">Baseball Bat</option></option> <option value="Mitt">Mitt</option></option> <option value="ball">Baseball</option> <option value="uniform">Uniform</option></select> <p><strong>Summary:</strong><br> <input type="text" name="summary" size="40"></p> <p><strong>Price:</strong><br> <input type="text" name="price" size="10"> <p><input type="submit" value="submit your request"></P> </form> </body> </html> Here is the code to the second script: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Newproducts.php</title> </head> <body> <?php $products = array( array( "Name:" => "Baseball Ball", "Summary:" => "Made of Aluminum", "Price:" => "$100", ) ); foreach ($products as $p) { while (list($k, $v) = each ($p)) { echo "$k $v <br>"; echo $_post['$k $v<br>']; } }; echo "<p><strong>Description:</strong><br>"; echo "<p>This bat is garanteed to hit home runs every single time you strike the ball."; echo "<p>No strikeouts or pop fly balls with this beauty."; echo "<p>Check it out!</p>"; $msg = "Name: $_post[username]\n"; $msg .= "E-Mail: $_post\n"; $msg .= "Phone: $_post[phone]\n"; $msg .= "Comment: $_post[comment]\n"; $recipient = "nookala@traderonline"; $subject = "For Submission Results"; $mailheaders = "From: My Web Site <deemurphy_us@yahoo.com> \n"; $mailheaders .= "Reply-To: $_post"; mail($recipient, $subject, $msg, $mailheaders); ?> <form action="newtext.php" method="post" enctype="application/x-www-form-urlencoded"> <p><strong>Name:</strong><br> <input type="text" name="username" id="username" size="25"> <p><strong>E-Mail:</strong><br> <input type="text" name="email" id="email" size="25"> <p><strong>Phone:</strong><br> <input type="text" name="phone" id="phone" size="12"> <p><strong>Comment:</strong><br> <textarea name="comment" rows="5" cols="40"></textarea></P> <p><input type="submit" value="send"></p> </form> </body> </html> Also is there a way to have all this in one script file? Thanks so much for your help. Dee Quote Link to comment https://forums.phpfreaks.com/topic/2356-forms-using-post-andor-get-statements/#findComment-7740 Share on other sites More sharing options...
deemurphy Posted June 18, 2005 Author Share Posted June 18, 2005 Thanks Matt. Here is the code to the first script. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Products</title> </head> <body> <img src="http://images.google.com/images?q=tbn:eMqGzBOAocEJ:www.wedowed.com/gc187.jpg"> <form action="newproducts.php" method="post"> <Strong>Select A Product</Strong><br> <select name="name[]" multiple> <option value="Baseball Bat">Baseball Bat</option></option> <option value="Mitt">Mitt</option></option> <option value="ball">Baseball</option> <option value="uniform">Uniform</option></select> <p><strong>Summary:</strong><br> <input type="text" name="summary" size="40"></p> <p><strong>Price:</strong><br> <input type="text" name="price" size="10"> <p><input type="submit" value="submit your request"></P> </form> </body> </html> Here is the code to the second script: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Newproducts.php</title> </head> <body> <?php $products = array( array( "Name:" => "Baseball Ball", "Summary:" => "Made of Aluminum", "Price:" => "$100", ) ); foreach ($products as $p) { while (list($k, $v) = each ($p)) { echo "$k $v <br>"; echo $_post['$k $v<br>']; } }; echo "<p><strong>Description:</strong><br>"; echo "<p>This bat is garanteed to hit home runs every single time you strike the ball."; echo "<p>No strikeouts or pop fly balls with this beauty."; echo "<p>Check it out!</p>"; $msg = "Name: $_post[username]\n"; $msg .= "E-Mail: $_post\n"; $msg .= "Phone: $_post[phone]\n"; $msg .= "Comment: $_post[comment]\n"; $recipient = "nookala@traderonline"; $subject = "For Submission Results"; $mailheaders = "From: My Web Site <deemurphy_us@yahoo.com> \n"; $mailheaders .= "Reply-To: $_post"; mail($recipient, $subject, $msg, $mailheaders); ?> <form action="newtext.php" method="post" enctype="application/x-www-form-urlencoded"> <p><strong>Name:</strong><br> <input type="text" name="username" id="username" size="25"> <p><strong>E-Mail:</strong><br> <input type="text" name="email" id="email" size="25"> <p><strong>Phone:</strong><br> <input type="text" name="phone" id="phone" size="12"> <p><strong>Comment:</strong><br> <textarea name="comment" rows="5" cols="40"></textarea></P> <p><input type="submit" value="send"></p> </form> </body> </html> Also is there a way to have all this in one script file? Thanks so much for your help. Dee 242910[/snapback] I never did get an answer for this problem. Please help. Dee Quote Link to comment https://forums.phpfreaks.com/topic/2356-forms-using-post-andor-get-statements/#findComment-7751 Share on other sites More sharing options...
Matt B. Posted June 20, 2005 Share Posted June 20, 2005 Sorry I forgot about this post. I'm taking a look at it as we speak, but in the meen time what exaclty are you trying to do with this script? Quote Link to comment https://forums.phpfreaks.com/topic/2356-forms-using-post-andor-get-statements/#findComment-7757 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.