Jump to content

Passing value from a data base via href to create query base user onKeyDown


telsiin

Recommended Posts

I have a some value that are being generated from a database then thrown into <li><href> to create a list that user can click and fetch data through ajax

 

right now its in a form select/menu and works fine however I need to convert to a list and use and onKeyDown event

 

<form>
<select name="users" size="<?php echo $num_rows;?>" onchange="showUser(this.value)"  >
  <?php
do {  
?>
  <option value="<?php echo $row_Recordset1['item_id']?>"><?php echo $row_Recordset1['item_id'].' '. $row_Recordset1['item_name']?></option>
  <?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  $rows = mysql_num_rows($Recordset1);
  if($rows > 0) {
      mysql_data_seek($Recordset1, 0);
  $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  }
?>
</select>
</form>

 

 

I need to correct this

<ol>
  <?php  do { ?>
  
  <li onKeyDown="showUser(this.value)"><a href="getmenu.php?item_id="<?php echo $row_Recordset1['item_id']?>"> <?php echo $row_Recordset1['item_name']?></a></li>
  	
<?php
  } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  	$rows = mysql_num_rows($Recordset1);
  	if($rows > 0) {
	mysql_data_seek($Recordset1, 0);
	 $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  }
?>
</ol>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.