How can i pass a <select> value to php page

Discussion in 'JavaScript' started by DigitalFTW, Nov 20, 2009.

  1. #1
    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)
    			$(this).parent().next().find("input").val(data[1]);
    	});
    	
    	
    $(":text, textarea").result(log).next().click(function() {
    		$(this).prev().search(); // shows resluts
    	});
    
    });
    
    
    </script>
    
    
    Code (markup):
    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>
    
    <label>Search</label>
    			<input type="text" id="search" />
    		</p>
    		<p>
    			<label>Hidden input</label>
    			<input  type="text" id="inputit" />
    
    
    Code (markup):
     
    DigitalFTW, Nov 20, 2009 IP