Jump to content

[SOLVED] Help with radio buttons


Leadwing

Recommended Posts

Hi there,

All I want is a very simple form with 2 radio buttons and a Next button.

Whichever button they choose will determine which page will appear next.

I've looked everywhere and tried several things but for some reason it just wont work!

Can someone help?

Thanks

Link to comment
Share on other sites

You need to submit the form one place first then see which radio button was selected and redirect them accordingly

 

Example:

 

<?php
if($_POST['radio_button'] == 'button1') {

  header("Location: button1_page.php");

  }
   elseif($_POST['radio_button'] == 'button2') {

  header("Location: button2_page.php");

  }
?>

 

In this case its probably best to put this in the top of your page with the form and set the form action to:

 

<form action="?" method="post">

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.