Miko Posted June 3, 2009 Share Posted June 3, 2009 Hello, I have a form with 2 radio buttons. Depending of the selected radio button my php script goes to a different site. The script isn't a problem, this one works how it should be. But when enter a value and hit enter the page refreshes and when I click on Track!, it actually goes to the website. ??? my code: <div class="track"> <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" class="track_form" target="_blank"> <input type="radio" name="radio1" value="Parcelnumber" checked><label for="parcel">Parcelnumber</label> <input type="radio" name="radio1" value="Referencenumber"><label for="reference">Referencenumber</label> <br /> <input type="text" name="searchvalue" class="track_search" size="29"> <input type="submit" name="track" value="Track!" class="track_bttn"> </form> </div><!-- track --> <?php $track_bttn = $_POST['track']; $radio1 = $_POST['radio1']; $searchvalue = $_POST['searchvalue']; $username = "******"; $password = "******"; $lang = "en"; if(isset($track_bttn) && isset($radio1)){ if($radio1 == 'Parcelnumber'){ header("Location:xxxxxxxxxxxxxxxxxxxxxxxxxxxx"); } if($radio1 == 'Referencenumber'){ header("Location:*************************"); } } ?> Anyone an idea? Quote Link to comment https://forums.phpfreaks.com/topic/160763-form-submit/ Share on other sites More sharing options...
Axeia Posted June 3, 2009 Share Posted June 3, 2009 Wouldn't that be rather logical? If you hit submit it submits.. and the forms action attribute is set to itself. Quote Link to comment https://forums.phpfreaks.com/topic/160763-form-submit/#findComment-848447 Share on other sites More sharing options...
Miko Posted June 3, 2009 Author Share Posted June 3, 2009 not exactly, I have another form where enter AND submit button works :-\ Quote Link to comment https://forums.phpfreaks.com/topic/160763-form-submit/#findComment-848451 Share on other sites More sharing options...
Axeia Posted June 3, 2009 Share Posted June 3, 2009 Guess your other form is only one field or something, try doing it using javascript. http://www.htmlcodetutorial.com/forms/index_famsupp_157.html Quote Link to comment https://forums.phpfreaks.com/topic/160763-form-submit/#findComment-848465 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.