Jump to content

Query result enables a checkbox or radio button


mm00re

Recommended Posts

Hi,  I have been having a little trouble getting a radio box or a checkbox to show the value of users and if they have supervisor privileges.

 

It's easy to do with a popup menu however I am trying to keep it as clean as I can.

 

I can echo the $super and the $checked variables and they show correctly but when I try to have it display in the form it's not working.

 

Thanks!

 

	$super = $row["dSupervisor"];

$checked = ($super==1) ? 'checked="checked"' : '';
echo $super;
        echo $checked;

//$active = $row["dActive"];
}

// Close the SQL connection
mysql_close($connection);
?>
  <strong>
  <div id="main">
    <form action="pr-update.php" method="post">
      <label for="dFirstName-l">First Name:</label>
      <input type="text" name="dFirstName" id="dFirstName-l" value="<? echo ($firstname);?>" />
      </br>
      <label for="dLastName-l">Last Name:</label>
      <input type="text" name="dLastName" id="dLastName-l" value="<? echo ($lastname);?>" />
      </br>
      <?php

echo 'Supervisor?:

<SELECT NAME="dSupervisor" SIZE="3" ID="supr">
<OPTION selected="' . $super . '">' . $super . '</OPTION>
<OPTION VALUE="Yes" <? if ($super=="Yes"){print "selected=\"selected\"";} ?>Yes</OPTION>
<OPTION VALUE="No" <? if ($super=="No"){print "selected=\"selected\"";} ?> No</OPTION>;</SELECT>';
?>
      <input type="radio" name="dSupervisor" id="dsupervisor-l" '.$checked.' />
      <br />

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.