Jump to content

select field change auto-fill fields


MSUK1

Recommended Posts

Hello

 

I have a script which propogates a select input with usersnames from a database,

 

i want to be able to when a user selects a member for the fields (containing the members info) to be propogated so that an admin can change the details

 

here is the script i use to get the members information:

 

function displayMembers($usern){

   global $usern;
   global $database;
   $q = "SELECT * "
       ."FROM ".TBL_MEMBERS." WHERE leader = '$usern'";
   $result = $database->query($q);
   /* Error occurred, return given name by default */
   $num_rows = mysql_numrows($result);
   if(!$result || ($num_rows < 0)){
      echo "Error displaying info";
      return;
   }
   if($num_rows == 0){
      echo "Database table empty";
      return;
   }
   /* Display table contents */
   echo "<select name=\"selmem\" id=\"selmem\" placeholder=\"Select A Member\" class=\"{validate:{required:true}}\">\n";
   echo "<option value=\"\">Please Choose A Member</option>\n";
   for($i=0; $i<$num_rows; $i++){
      $Mprefix = mysql_result($result,$i,"prefix");
      $Mfname  = mysql_result($result,$i,"firstname");
      $Mlname = mysql_result($result,$i,"lastname");
      $Mgender  = mysql_result($result,$i,"gender");
      $Mdob  = mysql_result($result,$i,"dob");
      $Mpostcode = mysql_result($result,$i,"postcode");
      $Memail = mysql_result($result,$i,"email");
      echo "<option value=\"$Memail\">$Mfname $Mlname ( $Memail )</option>\n";
   }
      echo "</select>";
}

 

 

all help appreciated

Link to comment
https://forums.phpfreaks.com/topic/264075-select-field-change-auto-fill-fields/
Share on other sites

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.