chwebdesigns Posted October 7, 2007 Share Posted October 7, 2007 I have this code, which I have got off the internet. What I want to do is instead of having the radio buttons, is to have a drop down menu. I have made it but unfortunately it doesn't work. Here is part of the code for the radio buttons: echo '<label for="rate5_'.$rater_id.'"><input type="radio" value="5" name="rating_'.$rater_id.'[]" id="rate5_'.$rater_id.'" />Excellent</label>'; echo '<label for="rate4_'.$rater_id.'"><input type="radio" value="4" name="rating_'.$rater_id.'[]" id="rate4_'.$rater_id.'" />Very Good</label>'; echo '<label for="rate3_'.$rater_id.'"><input type="radio" value="3" name="rating_'.$rater_id.'[]" id="rate3_'.$rater_id.'" />Good</label>'; echo '<label for="rate2_'.$rater_id.'"><input type="radio" value="2" name="rating_'.$rater_id.'[]" id="rate2_'.$rater_id.'" />Fair</label>'; echo '<label for="rate1_'.$rater_id.'"><input type="radio" value="1" name="rating_'.$rater_id.'[]" id="rate1_'.$rater_id.'" />Poor</label>'; And I changed it to this for use with a drop down menU: echo '<select name="select"> <label for="rate5_'.$rater_id.'"><option value="5" name="rating_'.$rater_id.'[]" id="rate5_'.$rater_id.'">Excellent</option></label> <label for="rate4_'.$rater_id.'"><option value="4" name="rating_'.$rater_id.'[]" id="rate4_'.$rater_id.'">Very Good</option></label> <label for="rate3_'.$rater_id.'"><option value="3" name="rating_'.$rater_id.'[]" id="rate3_'.$rater_id.'">Good</option></label> <label for="rate2_'.$rater_id.'"><option value="2" name="rating_'.$rater_id.'[]" id="rate2_'.$rater_id.'">Fair</option></label> <label for="rate1_'.$rater_id.'"><option value="1" name="rating_'.$rater_id.'[]" id="rate1_'.$rater_id.'">Poor</option></label> </select>'; Something is not working, and unfortunately I can't see what thanks Link to comment https://forums.phpfreaks.com/topic/72220-changing-radio-buttons-in-php/ Share on other sites More sharing options...
GingerRobot Posted October 7, 2007 Share Posted October 7, 2007 Something is not working What exactly does that mean? We're not actually psychic here you know. What actually happens? What specifically is the problem? Link to comment https://forums.phpfreaks.com/topic/72220-changing-radio-buttons-in-php/#findComment-364159 Share on other sites More sharing options...
Rithiur Posted October 7, 2007 Share Posted October 7, 2007 You should not have those label tags there. In addition, the name goes to the <select> tag and not the <option> tags (and you probably don't need the IDs either, since you don't have the labels). This might work slightly better: echo '<select name="rating_'.$rater_id.'[]"> <option value="5">Excellent</option> <option value="4">Very Good</option> <option value="3">Good</option> <option value="2">Fair</option> <option value="1">Poor</option> </select>' Link to comment https://forums.phpfreaks.com/topic/72220-changing-radio-buttons-in-php/#findComment-364162 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.