Hello coders,
I'm trying to create this ajax live search and I need to pass on 'hidden' input type...
So here's where i'm stuck:
So basically I need to pass the hidden input "pid" to each value. The 'fill' puts the data into the textbox and that part works fine. But I also need to add the hidden input 'pid'...So far it just displays the same 'pid' rather than the correct one depending on the result. I'm sure there's a better way to approach this. any clue?
thanks in advance.
I'm trying to create this ajax live search and I need to pass on 'hidden' input type...
So here's where i'm stuck:
Code:
$query = $db->query("SELECT pid, ptitle FROM projects WHERE ptitle LIKE '$queryString%' LIMIT 10");
if($query) {
while ($result = $query ->fetch_object()) {
echo <<<EOF
<li onClick="fill('$result->ptitle');">$result->ptitle</li>
<input type="hidden" name="pid" value=$result->pid>
EOF;
}
}
So basically I need to pass the hidden input "pid" to each value. The 'fill' puts the data into the textbox and that part works fine. But I also need to add the hidden input 'pid'...So far it just displays the same 'pid' rather than the correct one depending on the result. I'm sure there's a better way to approach this. any clue?
thanks in advance.