I m using an AutoComplete Textbox..!! i want to pass id and value to the next page..!!
here is my code..!!

PHP CODE

$sql1="SELECT * from 0_ledger where group_id not in(1,7) and user_id = $userid";
  $result1=mysql_query($sql)or die('Query error:'.''.mysql_errno());   
  $aUsers = array();
  while($row=mysql_fetch_array($result1)) {
  $aUsers[$row['ledger_id']] = $row['ledgerName'];
  $imp_aUsers = "'".implode("','",$aUsers)."'";

Javascript CODE

var months =  new Array(<?=$imp_aUsers; ?>); 
$().ready(function() {
    
    for(i=1;i<=iteration;i++)
    {
    $("#month_"+i).autocomplete(months, {
        minChars: 0,
        max: 14,
        autoFill: true,
        mustMatch: true,
        matchContains: false,
        scrollHeight: 220,
        formatItem: function(data, i, total) {
            return data[0];
        }
    })};

i want to pass id to the next page instead of Value..!!
.
.
Help me out..! :)

Recommended Answers

All 2 Replies

tutorial on javascript associative arrays

I can't really tell what you're problem is, could you elaborate?

okay let me elaborate with example..!!! have u ever use Select option..

<select><option value=''1'>Yes</select> 
<select><option value=''2'>No</select>

though if i select "Yes" but the value forward to the next page is 1..
when i select "No" and value forwar after submit is 2..!!

now the same thing i want for autocomplete textbox..!!

I have two fields in Database.. ledgerName and ledger_id

autocompelete textbox will show ledgerName... but i want that the id of selected ledgerName should be pass to next page..!!
.
.
I hope now to understand my Problem..!! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.