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

Recommended Answers

All 2 Replies

Member Avatar for diafol

Is this what you need?

<form>
Listing type: <input type="radio" name="name" value="free">Free<br>
<input type="radio" name="name" value="premium">Premium<br>
<input type="radio" name="name" value="featured">Featured<br>
<input type="submit" />
</form>

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.