|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
php and radiobutton
.php
$radio = '$_POST[rosta]'; if ($radio == 'a') { $query = "insert into fragor values(1, 2, 3)"; mysql_query($query, $link); } else if ($radio == 'b') { $query = "insert into fragor values(1, 2 ,3)"; mysql_query($query, $link); } .html <input type="radio" name="rosta" value="a"> <input type="radio" name="rosta" value="b"> it doesn't write the valuse in to the database, why? |
|
#2
|
|||
|
|||
|
RE: php and radiobutton
the name of the radio button is rosta not radio. change:
if ($radio == 'a') to: if ($rosta == 'a') also change other if stament. |
|
#3
|
|||
|
|||
|
RE: php and radiobutton
Actually, even tho the name of the radio button is rosta, that's not the problem. The code was trying to set $radio equal to the value of the radio button named 'rosta', which is just fine. However,
$radio = '$_POST[rosta]'; is not correct. try this.. $radio = $_POST['rosta']; see the difference? the way you had it, the post variables would not have been returned. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > php and radiobutton |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|