Jump to content

populating a radio button not working


jim.davidson

Recommended Posts

On my update member page the value stored in my table for a radio button doesn't register.  the value is "yes" but the yes button doesn't highlight.  What am I missing?  Here's the code

 

<td><div align="left">
<input 
<?php 
   if (!$_POST && !(strcmp($row_GetMember['county_relief'],"yes"))) {
     echo "checked=\"checked\"";
   }
  elseif ($_POST && !(strcmp($_POST['county_group'],"yes"))){
     echo "checked=\"checked\"";
  } 
?>
name="county_group" type="radio" class="text_background" value="yes" id="county_yes"/>
                     <label for="county_yes">Yes</label>
<input 
<?php 
   if (!$_POST && !(strcmp($row_GetMember['county_relief'],"no"))) {
      echo "checked=\"checked\"";
   }
   elseif ($_POST && !(strcmp($_POST['county_group'],"no"))){
      echo "checked=\"checked\"";
   }
?>
name="county_group" type="radio" class="text_background" id="county_no" value="no" />
                     <label for="county_no">No</label></div>
                 </td>

 

Any help will be appreciated

Link to comment
https://forums.phpfreaks.com/topic/174213-populating-a-radio-button-not-working/
Share on other sites

I figured it out myself

 

<td><div align="left">

            <label>

    <input <?php if (!$_POST && !(strcmp($row_GetMember['county_relief'],"yes"))) {echo "checked=\"checked\"";} elseif ($_POST && !(strcmp($_POST['county_group'],"yes"))) {echo "checked=\"checked\"";} ?> name="county_group" type="radio" value="yes" id="county_yes" />

    <label for="county_yes">Yes</label>

    <input <?php if (!$_POST && !(strcmp($row_GetMember['county_relief'],"no"))) {echo "checked=\"checked\"";} elseif ($_POST && !(strcmp($_POST['county_group'],"no"))) {echo "checked=\"checked\"";} ?> name="county_group" type="radio" id="county_no" value="no" />

    <label for="county_no">No</label>

</div>          </td>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.