php - get hidden value of the currently selected radio button -
i have form variables coming mysql query , , passing form 2 value of radio , hidden input , no problem radio .. hidden not passing correct value , passing first value found on page . want 2 value of radio , hidden when choose selected radio button
<input type="radio" name="radio" value="<?php echo $awardid ; ?>" /> <input type="hidden" name="point" value="<? echo $point ; ?>" />
after print :
<input type="radio" name="radio" value="1"> <input type="hidden" name="point" value="3"> <input type="radio" name="radio" value="2"> <input type="hidden" name="point" value="5"> <input type="radio" name="radio" value="3"> <input type="hidden" name="point" value="8"> elc ...
as example , when choose second radio , passing correct value of radio 2 , passing value of hidden 3 -> " that's not correct value , must 5 " . every , choose radio , passing first value of hidden on page -> 3 , when change hidden input radio input , choose , passing correct value without problem ... problem happen when input hidden .. why ? , solution ?
radio inputs share name in order define group.
hidden inputs cannot share names, discreet entities.
i'd suggest appending $awardid
hidden input's name.
<input type="hidden" name="point<?php echo $awardid; ?>" value="<?php echo $point ; ?>" />
then, can value of particular input based on selected radio button.
$radio = $_post['radio']; $point = $_post['point'.$radio];
Comments
Post a Comment