English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

If information would come from a MySQL Database, how do use AJAX to automatically refresh the information on the PHP page (without refreshing the entire page) as the customer interacts with the current information displayed on the page?

I'm using two optionbox, where by changing the first one, the entry of second would change according to our choice in first one! I want to do this without reloading of entire page...

this link (http://www.w3schools.com/ajax/ajax_database.asp) gives an example, but it uses asp, and I'm using php...

can you help me?

2006-07-18 00:40:25 · 3 answers · asked by QuestionAnswer 2 in Computers & Internet Programming & Design

John J:
thanks for your codes, but i sould use which code for javascript?

2006-07-18 01:57:09 · update #1

3 answers

what you need to do is create a php file that genereates the second option box based on what is selected in the first. Then use ajax to request that page and replace the entire drop down.

sort of like:



then the php would just do something like:
$selectedOption=$_REQUEST[ 'option1' ];
if($selectedOption=="1"){
$string = "";
$string = "";
}
else{//do stuff
}
return $string;
?>

the javascript would use whatever API you are using to request that second small php and when it got a response replace the innerHTML of the second select.

2006-07-18 00:52:41 · answer #1 · answered by John J 6 · 1 0

if you want to PHP, Mysql with the AJAX combination you have to study the XMLHTTP object.

This object makes the silent requests to the server and does all the job in the page. Rest is DHTML trick to refresh the page without loading it again.

2006-07-18 01:36:34 · answer #2 · answered by Ahsan 1 · 0 0

nicely all people can inform you certainly that what you're requiring won't gonna come genuine. you could creates variety with out those you reported utilizing HTML yet one factor for beneficial that with out utilizing server area language or Ajax you isn't waiting to post the variety tips that could server. a minimum of i've got not heard approximately this in the previous. sure you need to use captcha with out server area code utilizing javascript.

2016-10-08 01:23:02 · answer #3 · answered by esannason 4 · 0 0

fedest.com, questions and answers