help with ajax and javascript in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeddsal
    New Member
    • Dec 2011
    • 8

    help with ajax and javascript in php

    so basically i have a form which has an input type text for id and then i also have a input type text for name..

    and then i also have a query in which it gets the matching name for that id.

    sample : sql = "select name from names where id = '".$id."'";

    how can i implement this concept in which, you can input the id and then the name of that corresponding id which automatically display in the name textbox..

    Code:
    <label>Id</label>
    <input type="text" name="id" id="id"/>
    
    <label>Name</label>
    <input readonly="text" name="name" id="name" value="" />
    im new to javascript and ajax so i dont really know my way around it very much...i would really appreciate your help
  • YarrOfDoom
    Recognized Expert Top Contributor
    • Aug 2007
    • 1243

    #2
    Have a PHP-script output the value so an XMLHttpRequest-object in Javascript can request it.
    You can find the details on how to do this here: W3Schools AJAX Tutorial

    Comment

    Working...