Forum Moderators: coopster

Message Too Old, No Replies

Easy One

         

ayushchd

4:34 pm on Sep 30, 2007 (gmt 0)

10+ Year Member



Hi, I have something like this :

<select name="company" id="company" onChange="callAjax(this.value, '<?=$id?>');">

$query="SELECT * FROM listedcomp WHERE date='". $getdaterows[0] ."' ORDER BY company ;";

$result = mysql_query($query);
if (!$result) {
echo mysql_erorr();
}
$num = mysql_numrows($result);
for ($i = 0; $i < $num;) {
$row = mysql_fetch_assoc($result);
$id = $row['id'];
?>
<option value="<?=$row['company'];?>"><? echo $row['company'];?></option>

<? $i++; }

The function callAjax has $id as one of its arguments....but $id is declared after tht....I want it to have the value of the id of the company tht the user selects...is this possible?
?>

[edited by: eelixduppy at 4:39 pm (utc) on Sep. 30, 2007]

cameraman

5:16 pm on Sep 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you're saying what I think you're saying, then set the value of the option to $row['id'] instead of $row['company'].

ayushchd

5:20 pm on Sep 30, 2007 (gmt 0)

10+ Year Member



Yeah..you got it absolutely right on! thanks