Hi, I'm confusing myself. If I have a form with radio buttons in it, each of the inputs has to have the same name attribute for them to behave as a group, like this:

<input type="radio" name="pctype" value="standard" />
<input type="radio" name="pctype" value="custom" />

so only one button will be pressed. But what does $_POST send to the php script to differentiate them? Does it use the value attribute? And if so, will a piece of code likethis work to give values to the variables in php:

$pctypestandard = $POST['standard'];
$pctypecustom = $
POST['custom'];

And if so, will those values be 1 and 0 depending on which button was pressed?

Tim

    Hi TimG,
    In case of radio button PHP pass the value using radio button name. so the value will be the radio button you have selected. to get the value simply use the radio button name.

    Ex:
    print $_POST['pctype'];

    //this will print the value of the ratio button you have selected.

    Thanks
    Best regards,
    Niroshan

      Thanks for your help Niroshan, I now have it working properly.

        Write a Reply...