Show Some Love

PHP, AJAX Auto fill input fields from HTML select?

This forum was posted on Tuesday, March 12, 2013 10:15:42 AM

I hv been attempting for a while to search a right method of pulling info from a DB based on the initial text
selected on a html drop down menu.
Here is my code snippet:


Select a person:

database ID


Unique ID

Person info will be listed here.

test.js having:
function showUser(str)
if (str=="")
if (window.XMLHttpRequest)
{// code snippet for IE7+ Firefox Chrome Opera Safari
xmlhttp=new XMLHttpRequest();
{// code snippet for IE6 IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
if (xmlhttp.readyState==4 && xmlhttp.status==200)
}"GET" "getuser.php?q="+str true);

Get member having:

var ids = '';
var content = '';
var uid = '';

84 Viewed this Question

 Recent Replies on "PHP, AJAX Auto fill input fields from HTML select?"

  • Nobody has replied on this post, be first to post answer.

Post Your Solution for this Question

Note: Please Put Code into <code></code> block.

Threads related to "PHP, AJAX Auto fill input fields from HTML select?":

MySQL insert wouldn't work. Using MySQL 5 closed

Hi I hv added the following SQL query below. This normally works for me. However today I hv spent more time than i wish to admit trying to figure out why it no longer works. I am working with MySQL 5.I get the following error from mysql_error() you have an error in your SQL syntax; checkout the manual that corresponds to your MySQL server Ver. for the right syntax to use near ' Logan "Logan" In this condition being the value of $name. Plz any advice as to why this doesn't wor

Php => 3 level array syntaxe

i require to make an associative array that having the people's last name as the key and and numerical array (0 1 ...) as the value that having the first name city and age of the person. I normaly know what to do when it's a 2 level array but since it's an array in an array I'm getting little problem.I hv tried various things but this is what I'm trying rightnow: $tableau = array( "Delorme" =>0 => "John" 1 => "Montreal" 2 => "58" )

How to display errors all at once rather than one at a time? closed

In code snippet snippet below it is suppose to having all the errors in an array and then show the errors in one depening on which errors are activated. But problem is that it is still displaying the errors only one at a time it is not displaying att the related errors at once. What should i require to change in order to do this?$errors = array(); if (!$getcourseid){ $errors = "You must enter in Course's ID"; }else if (!$getcoursename){ $errors = "You must enter in Course's Name"; }else i

ID of clicked ‘href’ tag closed

MySQL having three tables ‘country’ ‘region’ and ‘city’ the code snippet snippet and it's functions are running well and are doing the following:When I press ‘country’ the matching list of regions is open when I press ‘region’ the matching list of cities is open.The following is a small segment of the code snippet snippet showing ‘regions’: ');">How do I get the ID of the selected ‘href’ that I clicked?

PHP get more after last limit closed

I am trying to make a simple "load more" button where I hv an ajax request a load more page which loads a little more database entries. My problem is I can do my select statement like so:$result = $db->query("SELECT uid username image FROM tbl_multimedia LIMIT 3");But generally I click it I see the first 3 o/p not the fourth and so forth. This code snippet snippet does not count or checkout to see which id has been loaded last and start from the next. I am trying to keep it simple any quick

PHP echo within form value

I'm attempting to echo a div tag within a HTML form value. I'm incapable to show the contents of the div tag without messing up the form value. ';?>Form value...';?>">What's outputted... (What's echoed inside the form value should be the current longitude and latitude)Geolocation search Search Term: ';?>"> Name &nbsp;';?>var x=document.getElementById("demo");function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); }

PHP - replace tags and return src

Mission is to replace all tags in given string with tags and src feature as inner text.In search for the solution I found similar problem $content = "this is something with an in it."; $content = preg_replace("/+\>/i" "(image) " $content); echo $content;?>solution:this is something with an (image) in it.issue: How do I upgrade script ant get this solution:this is something with an test.png in it.

Codeigniter + CSS not working well, possible baseurl

This issue has been asked a some times but I researched and still can not fix it. In one of my view file I hv (referencing to my css):link rel="stylesheet" type="text/css" href="/application/views/screen.css"The css file is in:- www - app - view - css - screen.css - systemI also tried to setup the css in the similar folder under -www and use it directly by link rel="stylesheet" type="text/css" href="css/screen.css"My bas

PHP If / Else statement not working in While loop

I hv been working on this bit of code snippet snippet for about an hour and can not appear to figure out why it's not working. Does PHP permit If/Else statements within While loops? I hv tried adding various echos to both If/Else statements and the latter (Else) will not show. Is this becoz I'm trying to use the similar variable names? while($row = mysql_fetch_array($result)){//assign variables$title = $row'title';$file_url = $row'file_location';$category = $row'category';$layout = $row'l

php and html form on the same page

I am learning php. I am passing little values from one page to other page and letting the user enter form into this page and then saving into the database.i wish to stay on the similar page so Rather of this1st page- update.php $name= $_POST'name';?>i require to be on the similar page becoz I am getting little variables and arrays from a older page with get()$count= $_GET'count';$sum= $_GET'Sum';for ($i=0;$iecho unserialize($_GET'serialized_name')$i;?>Since I also require to send the form values so I