ok so i have a html form with a tex area and texboxes. I have little coding experience with javascript. I have a php script that querys my mysql database and pulls 'firstname' and 'last name' and displays them in the textarea. I need the firstname and lastname to be clickable so that the rest of the information from that database record is populated into textboxes, ie when the name is clicked I need the coresponding ssn to be placed into the txtssn textbox.


here is the code for my form

SETTINGS.PHP
Code:
<?php

$hostname = "localhost"; 
$username = "***********"; 
$password = "***********"; 
$database = "***********";
$dataconn = mysql_connect($hostname, $username, $password)
or die ('Error connecting to mysql');

$dbselect = mysql_select_db($database, $dataconn)
or die("Could not select examples"); 

?>
EMPEDIT.PHP
Code:
<?php

if ($_POST['select1']=="New Employee") {
	$SQL = " INSERT INTO employee ";
	$SQL = $SQL . " (firstname, lastname, ssn, dob, add1, add2, phone, empid, position, hiredate, termdate, status, salary) VALUES ";
	$SQL = $SQL . " ('$txtfirstname', '$txtlastname', '$txtssn', '$txtdob', '$txtadd1', '$txtadd2', '$txtphone', '$txtempid', '$txtposition', '$txthiredate', '$txttermdate', '$txtstatus', '$txtsalary') ";
	$result = mysql_db_query($database,"$SQL",$dataconn);
	if (!$result) { echo("ERROR: " . mysql_error() . "$SQL"); } 
} 

?>
<form name="form1''" method="post" action="index.php">
<span align="left">
  <table width="825" border="0" bgcolor="#FAFAFA">
    <tr>
      <td width="155" rowspan="6" valign="top">
        <span align="center">
          <textarea name="select1">
<?php

$result = mysql_query("SELECT firstname, lastname FROM employee");
while ($row = mysql_fetch_array($result)) {
   echo "".$row{'firstname'}." ".$row{'lastname'}." <html> <br> </html> ";
}

?>
            
          </textarea>

      </td>
	<td width="299" height="10">First Name / DBA
      </td>			
	<td width="151" height="10">SSN / Tax ID
      </td>			
	<td width="151" height="10">Position
      </td>
    </tr>
    <tr>
      <td width="299" height="10">
        <span align="center">
          <input type="text" name="txtfirstname" value="First, Middile Initial">
          <input type="text" name="txtlastname" value="Last Name">
        </span>
      </td>
      <td width="151" height="10">
        <span align="center">
          <input type="text" name="txtssn">
        </span>
      </td>
      <td width="151" height="10">
        <span align="center">
          <input type="text" name="txtposition">
        </span>
      </td>
    </tr>
    <tr>
      <td width="299" height="10">Address
      </td>			
	<td width="151" height="10">Date Of Birth
      </td>			
	<td width="151" height="10">Start Date
      </td>
    </tr>
    <tr>
      <td width="299" height="10"> 
        <span align="center">
          <input name="txtadd1" type="text" value="Street Address">
          <input name="txtadd2" type="text" value="City, State, Zip">
        </span>
      </td>
      <td height="10">      
        <span align="center">
          <input type="text" name="txtdob">
        </span>
      </td>
      <td height="10">
        <span align="center">
          <input type="text" name="txthiredate">
        </span>
      </td>
    </tr>
    <tr>
      <td width="299" height="10">Phone Number
      </td>			
	<td width="151" height="10">Employee ID Number
      </td>			
	<td width="151" height="10">Term Date
      </td>
    </tr>
    <tr height="20">
      <td width="299" height="10"> 
        <span align="left">
          <input name="txtphone" type="text" value="XXX-XXX-XXXX">
        </span>
      </td>
      <td height="10">   
        <span align="center">
          <input type="text" name="txtempid">
        </span>
      </td>
      <td height="10">
        <span align="center">
          <input type="text" name="txttermdate">
        </span>
      </td>
    </tr>
    <tr>
      <td height="20" rowspan="2">
        <span align="center">
          <input type="submit" value="Save">
        </span>
      </td>
      <td width="299" height="10">&nbsp;
      </td>			
	<td width="151" height="10">Status 
      </td>			
	<td width="151" height="10">Salary 
      </td>
    </tr>
      <td width="299" height="10">&nbsp;
      </td>
      <td height="10">
        <span align="center">
          <select name="txtstatus">
            <option>Active</option>
            <option>Inactive</option>
          </select>
        </span>
      </td>
      <td height="10">
        <span align="center">
          <input type="text" name="txtsalary">
        </span>
      </td>
    </tr>
  </table>
  </span>
        </form>
Thanks