Further PHP and AJAX MySQL Database Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wheatcom
    New Member
    • Sep 2008
    • 1

    Further PHP and AJAX MySQL Database Problem

    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:
    [code=html]
    <body><form>
    Select a User:
    <select name="users" onchange="showU ser(this.value) ">
    <option value="1">20000 01</option>
    <option value="2">20000 02</option>
    <option value="3">20000 03</option>
    <option value="4">20000 04</option>
    </select>
    </form><p>
    <div id="txtHint"><b >User info will be listed here.</b></div>
    [/code]
    I am trying to get the same result but with an "input" rather than "select"
    [code=html]
    <form>
    Select a User:
    <input type="text" name="users" onchange="showU ser(this.value) ;">
    </form><p>
    <div id="txtHint"><b >Phoenix Part Number Will Be Listed Here.</b></div>
    [/code]
    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
    Last edited by pbmods; Sep 18 '08, 10:34 PM. Reason: Added CODE tags.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    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.

    Comment

    Working...