Populate input field using dynamic menu selection

I want to populate these input fields using this php and javascript. Could someone tell me whats wrong or missing. Thanks!

<?php virtual('/Connections/connection.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_connection, $connection); $query_franchises = "SELECT ID, company, `description`, address, city, `state`, zip, phone FROM franchise ORDER BY ID ASC"; $franchises = mysql_query($query_franchises, $connection) or die(mysql_error()); $row_franchises = mysql_fetch_assoc($franchises); $totalRows_franchises = mysql_num_rows($franchises); ?> Untitled Document
<body>
<form action="/Administrator/sample.php" method="get" name="Form1">
  <table width="600" border="0">
    <tr>
      <td><select name="franchise" id="franchise" onchange="selectCompany(this)">
          <?php do     
		  {  ?>
          <option value="<?php echo $row_franchises['company']?>"            
		  <?php if (!(strcmp($row_franchises['company'], $row_franchises['company'])))             
		  {echo "selected=\"selected\"";} ?>><?php echo $row_franchises['company']?></option>
          <?php }         
		  while ($row_franchises = mysql_fetch_assoc($franchises));          
		  $rows = mysql_num_rows($franchises);          
		  if($rows > 0) {              
		  mysql_data_seek($franchises, 0);              
		  $row_franchises = mysql_fetch_assoc($franchises);          
		  }    
		  ?>
        </select></td>
    </tr>
    <tr>
      <td><input name="description" type="text" id="description" value=""></td>
    </tr>
    <tr>
      <td><input name="address" type="text" id="address" value=""></td>
    </tr>
    <tr>
      <td><input name="city" type="text" id="city" value=""></td>
    </tr>
    <tr>
      <td><input name="state" type="text" id="state" value=""></td>
    </tr>
    <tr>
      <td><input name="zip" type="text" id="zip" value=""></td>
    </tr>
    <tr>
      <td><input name="phone" type="text" id="phone" value=""></td>
    </tr>
  </table>
</form>
<?php mysql_free_result($franchises); ?>
Sponsor our Newsletter | Privacy Policy | Terms of Service