martyoo Posted August 28, 2007 Share Posted August 28, 2007 Ok so what I have is a basic form with two fields D and M. when the person enters D and M and clicks Submit I want the contents of D and M to fill their respective areas of a web link. This the link. http://website.net/sendsms.aspx?s=m&d=085654321&m=Hi Any ideas? Marty Quote Link to comment https://forums.phpfreaks.com/topic/67039-solved-feeding-data-from-php-form-to-web-link/ Share on other sites More sharing options...
trq Posted August 28, 2007 Share Posted August 28, 2007 Just send the form using the GET method. eg; <form method="get"> Quote Link to comment https://forums.phpfreaks.com/topic/67039-solved-feeding-data-from-php-form-to-web-link/#findComment-336195 Share on other sites More sharing options...
Neptunus Maris Posted August 28, 2007 Share Posted August 28, 2007 <?php if (!isset($_POST[submit])) { $form = "yes"; } elseif (isset($_POST[submit])) { header("Location: http://website.net/sendsms.aspx?s=m&d=$_POST[d]&m=$_POST[m]"); exit; } //end if if ($form == "yes") { $display = "<form action = \"$_SERVER[php_SELF]\" method = \"post\">\n"; $display .= "<table border = 0>\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">D:</td>\n"; $display .= "<td><input type = \"text\" name = \"d\"></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">M:</td>\n"; $display .= "<td><input type = \"text\" name = \"m\"></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td></td>\n"; $display .= "<td><input type = \"submit\" name = \"submit\" value = \"Go\"></td>\n"; $display .= "</tr>\n"; $display .= "</table>\n"; $display .= "</form>\n"; } //end if ?> <html> <head> <title>Test Page</title> </head> <body> <p><?php print "$display"; ?></p> </body> </html> That should do it! Quote Link to comment https://forums.phpfreaks.com/topic/67039-solved-feeding-data-from-php-form-to-web-link/#findComment-336201 Share on other sites More sharing options...
martyoo Posted August 28, 2007 Author Share Posted August 28, 2007 Wow! I wasnt expecting that. Thanks very much. Marty Quote Link to comment https://forums.phpfreaks.com/topic/67039-solved-feeding-data-from-php-form-to-web-link/#findComment-336210 Share on other sites More sharing options...
martyoo Posted August 28, 2007 Author Share Posted August 28, 2007 Ok, so with that code it brings up two form fields asking for D and M and when I fill it in it works fine, but what I wanted to do was to get the D and M areas of the web link filled in automatically and then it would visit the site with the new data. Is this possible? Thanks again Marty Quote Link to comment https://forums.phpfreaks.com/topic/67039-solved-feeding-data-from-php-form-to-web-link/#findComment-336248 Share on other sites More sharing options...
trq Posted August 28, 2007 Share Posted August 28, 2007 but what I wanted to do was to get the D and M areas of the web link filled in automatically With what data? Where are the values you want placed in D and M coming from? Quote Link to comment https://forums.phpfreaks.com/topic/67039-solved-feeding-data-from-php-form-to-web-link/#findComment-336254 Share on other sites More sharing options...
martyoo Posted August 28, 2007 Author Share Posted August 28, 2007 Hi, I have a form with two fields D and M. when someone fills out these fields and clicks submit I wanted the data from those two fields to fill the respective areas of the web address and then for the user to be brought to that address. http://website.net/sendsms.aspx?s=m&d=085654321&m=Hi Thanks Quote Link to comment https://forums.phpfreaks.com/topic/67039-solved-feeding-data-from-php-form-to-web-link/#findComment-336263 Share on other sites More sharing options...
Jessica Posted August 28, 2007 Share Posted August 28, 2007 What? That is what it does... Quote Link to comment https://forums.phpfreaks.com/topic/67039-solved-feeding-data-from-php-form-to-web-link/#findComment-336264 Share on other sites More sharing options...
martyoo Posted August 28, 2007 Author Share Posted August 28, 2007 I must be doing something wrong because when I fill out the form and then submit it through the form that Neptunus made it brings up two empty fields. If I then enter data on those two fields and click Go it works perfectly. But I wanted it all to happen automatically. So what I mean is when the data is entered in the form fields the data is then added onto the link and the user is brought to the site. Am I doing something wrong with the script? Thanks Marty Quote Link to comment https://forums.phpfreaks.com/topic/67039-solved-feeding-data-from-php-form-to-web-link/#findComment-336277 Share on other sites More sharing options...
trq Posted August 28, 2007 Share Posted August 28, 2007 You don't need all the code that Neptunus made. All you need is.... <form action="http://website.net/sendsms.aspx?s=m" method="get"> <input type="text" name="d"> <input type="text" name="m"> <input type="submit"> </form> as I said in my first reply. Use get as your forms method. Quote Link to comment https://forums.phpfreaks.com/topic/67039-solved-feeding-data-from-php-form-to-web-link/#findComment-336409 Share on other sites More sharing options...
martyoo Posted August 28, 2007 Author Share Posted August 28, 2007 Sorry I was looking at it totally different. Thanks to all for the help and patience Quote Link to comment https://forums.phpfreaks.com/topic/67039-solved-feeding-data-from-php-form-to-web-link/#findComment-336556 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.