By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,460 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

Further PHP and AJAX MySQL Database Problem

P: 1
This problem relates to modifying the code in the PHP and AJAX MySql Database Example in http://bytes.com/forum/thread608395.html.

In that example, the value selected in the HTML form is from a drop down menu:
Expand|Select|Wrap|Line Numbers
  1. <body><form> 
  2. Select a User:
  3. <select name="users" onchange="showUser(this.value)">
  4. <option value="1">2000001</option>
  5. <option value="2">2000002</option>
  6. <option value="3">2000003</option>
  7. <option value="4">2000004</option>
  8. </select>
  9. </form><p>
  10. <div id="txtHint"><b>User info will be listed here.</b></div>
  11.  
I am trying to get the same result but with an "input" rather than "select"
Expand|Select|Wrap|Line Numbers
  1. <form> 
  2. Select a User:
  3. <input type="text" name="users" onchange="showUser(this.value);">
  4. </form><p>
  5. <div id="txtHint"><b>Phoenix Part Number Will Be Listed Here.</b></div>
  6.  
It does not appear that the value is being passed to the php script. Is there some different coding required when the value is created from "input" rather than "select"?

Thanks,

Paul Cardin
Sep 18 '08 #1
Share this Question
Share on Google+
1 Reply


Atli
Expert 5K+
P: 5,058
Hi.

When using the <input type="text"> element, you should use the onkeyup, or one of the other onkey events. The onchange event won't work as it does on the <select> element.
Sep 20 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.