Simple PHP question (radio button)?

Bobupop

New member
I have a form with three radio buttons and a submit button.

<FORM name ='form1' method ='post' action ='cd.php?id=$id'>
<Input type = 'Radio' Name ='sort' value= 'name'>
<Input type = 'Radio' Name ='sort' value= 'length'>
<Input type = 'Radio' Name ='sort' value= 'number'>
<Input type = "Submit" Name='sort' VALUE = "Sort this!">

</FORM>

I would like the submit button to add the "sort" value to the cd.php URL
example: cd.php?id=0&sort=length

how do i do this?
I dont know how to check which radio button is checked
 
the variable that will hold your form value of "sort" will be

$_POST['sort'] <- but only after the submit button or whatever is pressed

if your form method was 'get' instead of post, the value would be

$_GET['sort']

so in your code it would be cd.php?id=$id&sort=$_POST[sort]
 
Back
Top