Hi, I am trying to create a page where depending on which one of three radio buttons is selected something different happens. The context is that users have already registered and so the 'gigname' is taken from url (which seems to work now).The original url looks like example.com/listtype.php?name=gigname (with the correct gigname appearing).However instead of doing what it is supposed after submit the url just changes to example.com/listtype.php?type=(and in here the value appears from the chosen radio button).I do not know what is going wrong so any help would be appreciated, here is the code: <? $gigname = $_GET['name']; ?> <form> Listing type: <input type="radio" name="type" value="free">Free<br> <input type="radio" name="type" value="premium">Premium<br> <input type="radio" name="type" value="featured">Featured<br> <input type="submit" /> </form> <? if(isset($submit) && isset($free)) { header ("Location: http://www.example.com/gig.php?name=' . $gigname . '"); } elseif(isset($submit) && isset($premium)) { echo 'do something else'; } elseif(isset($submit) && isset($featured)) { echo 'do another thing'; } elseif(isset($submit) && !isset($free) && !isset($premium) && !isset($featured)) { echo 'please make a selection'; } ?> Thanks in advance
it's no good way. your varios is <inputtype="radio"name="type"value="free">Free<br> so you must use condition if($type == 'free') ...
Some cases simply because a single or double quotes. try it: header ("Location: http://www.example.com/gig.php?name=" . $gigname );
Is this what you're after? <?php $gigname = $_GET['name']; ?> <form method="POST"> Listing type: <input type="radio" name="type" value="free">Free<br> <input type="radio" name="type" value="premium">Premium<br> <input type="radio" name="type" value="featured">Featured<br> <input type="submit"/> </form> <?php if(isset($_POST['type'])) { switch($_POST['type']) { case "free": header("Location: http://www.example.com/gig.php?name=" . $gigname); break; case "premium": echo "Something for the premium members"; break; case "featured": echo "Something for the featured members"; break; default: echo "Please make a selection"; break; } } ?> PHP:
<html> <body> Welcome <?php echo $_POST["fname"]; ?>!<br /> You are <?php echo $_POST["age"]; ?> years old. </body> </html>this is also wen design and development company in chennai. for more information visit chennaipixel
make a connention page then another page name form then through ajax do that. for more help please go to http://phproots.com.
radio buttons in the same form field will come as arrays() Easiest way to do this is to use AJAX and the onChange feature to grab the PHP handler file and run your script that way. This way theres no radio button SUBMIT necessary since it changes as you click it. In this method you can use buttons, and anything else you want other than being limited to radio button. IM me if you want AJAX method, I create and sell them in all forms and AJAX engine forms. with PHP handlers, and all of them are customize-able. Once you use AJAX and PHP combo, you'll never go back to page reloads and submission forms with their limitations and annoying clicking/clacking page reloading. Oh yeah, and without spam you can also see what Im referring to , down lower in my sig.