help sort

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kamsmartx
Forum Newbie
Posts: 21
Joined: Mon Apr 21, 2008 10:03 am

help sort

Post 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];
}
 
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: help sort

Post 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? :|
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: help sort

Post 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) {
Post Reply