更改单选按钮上的名称值(引导程序)

The goal is to create four inline radio buttons, with a button to submit the form to a simple php script. The problem is that changing the name attribute from 'optradio' to something like 'small' breaks the switching between buttons.

The html:

    <form action="logo-tshirt.php" method="post">
        <label class="radio-inline"><input type="radio" name="small" value="1">S</label>
        <label class="radio-inline"><input type="radio" checked name="medium" value="1">M</label>
        <label class="radio-inline"><input type="radio" name="large" value="1">L</label>
        <label class="radio-inline"><input type="radio" name="extra-large" value="1">XL</label><br />
        <input style="margin-top:5px" type="submit" value="Buy With PayPal" name="send" class="btn btn-primary">
    </form>

The php:

<?php
if($_POST['small'] == 1 ){ 
    header("Location: http://www.google.com"); 
} 
elseif($_POST['medium'] == 1 ){ 
    header("Location: http://www.yahoo.com"); 
} 
elseif($_POST['large'] == 1 ){ 
    header("Location: http://www.bing.com"); 
} 
elseif($_POST['extra-large'] == 1 ){ 
    header("Location: http://www.bbc.co.uk"); 
} 
else { 
    header("Location: http://www.theguardian.co.uk"); 
} 
?>

Thanks for all the answers. The one i used was AI.G's because it used the least lines of code. This is my working code.

<form action="logo-tshirt.php" method="post">
    <label class="radio-inline"><input type="radio" name="optradio" value="small">S</label>
    <label class="radio-inline"><input checked type="radio" name="optradio" value="medium">M</label>
    <label class="radio-inline"><input type="radio" name="optradio" value="large">L</label>
    <label class="radio-inline"><input type="radio" name="optradio" value="extra-large">XL</label><br />
    <input style="margin-top:5px" type="submit" value="Buy With PayPal" name="send" class="btn btn-primary">
</form>

The php:

<?php
switch ($_POST['optradio']) {
    case "small": header("Location: http://www.google.com"); break;
    case "medium": header("Location: http://www.yahoo.com"); break;
    case "large": header("Location: http://www.bing.com"); break;
    case "extra-large": header("Location: http://www.bbc.co.uk"); break;
    default:header("Location: http://www.theguardian.co.uk");   /* if $_POST['option'] was none of the above */
}
?>

All radios should have the same name but different values:

<label class="radio-inline"><input type="radio" name="option" value="small">S</label>
<label class="radio-inline"><input type="radio" checked name="option" value="medium">M</label>
<label class="radio-inline"><input type="radio" name="option" value="large">L</label>
<label class="radio-inline"><input type="radio" name="option" value="extra-large">XL</label>

Now check them using a switch:

switch ($_POST['option']) {
    case "small": /* redirect to google */ break;
    case "medium": /* redirect to yahoo */ break;
    /* etc... */
    default:
        /* if $_POST['option'] was none of the above */
        /* redirect to somewhere else */
}

You have it a little bit wrong. The radio buttons must have a common name, and their value is what actually is sent to the server. Example :

<form action="a.php" method="post">
   <label class="radio-inline"><input type="radio" name="buy" value="small">S</label>
   <label class="radio-inline"><input type="radio" name="buy" checked value="medium">M</label>
   <label class="radio-inline"><input type="radio" name="buy" value="large">L</label>
   <label class="radio-inline"><input type="radio" name="buy" value="extra-large">XL</label><br />
   <input style="margin-top:5px" type="submit" value="Buy With PayPal" name="send" class="btn btn-primary">
</form>

Now you can extract the chosen value by $_POST

if ($_POST['buy'] == 'small' ){ 
    header("Location: http://www.google.com"); 
} 

...etc