View Full Version : How can i pass a <select> value to php page

Nov 20th, 2009, 11:57 PM
ok i have auto complete that i want to be able to select a column of the database before searching on it
i just want to pass the oneone variable over to the php page.

so i have this javascript

<script type="text/javascript">
$().ready(function() {

function log(event, data, formatted) {
$("<li>").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#result");

$("#search").autocomplete("test.php", {
width: 260,
selectFirst: false
$("#search").result(function(event, data, formatted) {
if (data)

$(":text, textarea").result(log).next().click(function() {
$(this).prev().search(); // shows resluts



the html

<p class="field" > <select id="oneone" name="oneone" style="width:100px;margin:5px 0 5px 0;" value="">
<option value="s_last">Last Name</option>
<option value="s_first">First Name</option>

<input type="text" id="search" />
<label>Hidden input</label>
<input type="text" id="inputit" />

Old Pedant
Nov 21st, 2009, 12:55 AM
Your HTML is illegal. You have a <select> but no </select>.

I'm *guessing* that because of that the <select>'s value is not sent to the PHP page, if indeed that's the behavior you are seeing. You don't show the PHP code, so that's a real guess.