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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.