Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //form start
- <input type="text" name="mobile" id="mobile" onchange = "mobilecheck();" size="10" maxlength="30" value="" />
- <input type="text" name="extension" id="extension" onchange = "extensioncheck();" size="10" maxlength="30" value="" />
- //form end
- //auto populate work well so I skip those codes
- //function start
- var url = "check.php?q=";
- function mobilecheck() {
- var idValue = document.getElementById("mobile").value;
- var myRandom=parseInt(Math.random()*99999999); // cache buster
- if (idValue=="") return;
- http.open("GET", url + escape(idValue) + "&rand=" + myRandom, true);
- http.onreadystatechange = handleHttpResponse;
- http.send(null);
- }
- function extensioncheck() {
- var idValue = document.getElementById("extension").value;
- //the other are same with mobilecheck() so skip it
- //function end
- //query start
- $result = mysql_query("SELECT * FROM mycontact WHERE (mobile like '$q') or (extension like '$q'));
- //query end
- //form start
- <input type="text" name="mobile" id="mobile" onchange = "check('mobile');" size="10" maxlength="30" value="" />
- <input type="text" name="extension" id="extension" onchange = "check('extension');" size="10" maxlength="30" value="" />
- //form end
- var url = "check.php?q=";
- function check(type){
- var idValue = document.getElementById(type).value;
- var myRandom=parseInt(Math.random()*99999999); // cache buster
- if (idValue=="") return;
- http.open("GET", url + escape(idValue) + "&rand=" + myRandom, true);
- http.onreadystatechange = handleHttpResponse;
- http.send(null);
- }
Add Comment
Please, Sign In to add comment