Page 1 of 1

help sort

Posted: Wed May 07, 2008 12:50 pm
by kamsmartx
hi
i hve this code , this code is sort data to data base , but when i select valuse form list print value of other filed ,,,

but the wrong is :--
when i dislpy data i see on file address , tell , pationtname ,the value "pationtname " why !!!

we must print on address, tell , pationtname value of each

:confused: :confused: :confused:

Code: Select all

 
<select name="FileNO" onChange="change_pationt(this.value);">
            <? 
 
$query="SELECT * FROM pationt";
$result=mysql_query($query) or die("error: " . mysql_error());
while($row=mysql_fetch_array($result))
{
?>  
<option value="<?php echo $row['PationtName'] . '^' . $row['address'] . '^' . $row['tell']; ?>"><?php echo $row['PNO'] ; ?></option>   
<?
 
    }  
?>
</select>
<input name="PationtName" type="text" id="PationtName"/>
 
<input name="address" type="text" id="address"/>
 
<input name="tell" type="text" id="tell"/>
 

Code: Select all

 
function change_doctor(ref) {
  var arr = ref.split(/^/);
  document.getElementById('PationtName').value  = arr[0]; 
  document.getElementById('address').value  = arr[1];
  document.getElementById('tell').value  = arr[2];
}
 

Re: help sort

Posted: Wed May 07, 2008 3:57 pm
by kendall

Code: Select all

$query="SELECT * FROM pationt ORDER BY address";
$result=mysql_query($query) or die("error: " . mysql_error());
could be what you want...i take it you dont speak english that well? :|

Re: help sort

Posted: Wed May 07, 2008 4:14 pm
by onion2k
Are you calling the right function? In the first bit you have..

Code: Select all

onChange="change_pationt(this.value);"
And in the second you have..

Code: Select all

function change_doctor(ref) {