Dropdown value selection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ghjk
    Contributor
    • Jan 2008
    • 250

    Dropdown value selection

    I have a drop down box and the test box for the search field. In there I user only dropdown box to search values from the DB. But now I want to pass text box value with dropdownbox value. How can I do that? This is my working php code for only dropdown search.
    Code:
    <table width="508" align="center"  border="0">
    				<form>
    				 <tr>
    					<td width="169">
    					<select name="users" onchange="showUser(this.value);">
    						<option value="1">Name</option>
    						<option value="2">Number</option>
    						<option value="3">Phone Number</option>
    						<option value="4">Email Address</option>
    					</select>
    					</td>
    					<td colspan="2" ><input name="search" type="text" size="40" value=""/></td>
    				<td width="76"><input src="images/Search.jpg" type="image"  alt="Confirm"  name="search"  /></td>
    				  </tr>
    				  </form>
    				</table><?php
    				?>
    		 <div id="txtHint"></div>
    This is my ajax code

    Code:
    function showUser(str)
    {
    	
    	req= GetXmlHttpObject();
    	var url="User.php";
    	url=url+"?q="+str;
    	
    	url=url+"&sid="+Math.random();
    	
    	req.onreadystatechange=stateChanged;
    	req.open("GET",url,true);
    	req.send(null);
    }
    function stateChanged()
     {
    if (request.readyState==4)
    	{
    		document.getElementById("txtHint").innerHTML=request.responseText;
    	}
     }
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    just have another text box and added to that url variable like so &text=" + txtField.value.



    Dan

    Comment

    Working...