Click here to Skip to main content
16,004,761 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
Questionyahoo messenger Pin
venu65620-Feb-09 23:35
venu65620-Feb-09 23:35 
Questionmultiple checkbox Pin
rose19619-Feb-09 1:01
rose19619-Feb-09 1:01 
AnswerRe: multiple checkbox Pin
jceresini8-Mar-09 18:13
jceresini8-Mar-09 18:13 
QuestionURL rewriting Pin
random418-Feb-09 21:40
random418-Feb-09 21:40 
AnswerRe: URL rewriting Pin
Perspx18-Feb-09 22:00
Perspx18-Feb-09 22:00 
GeneralRe: URL rewriting Pin
random423-Feb-09 22:33
random423-Feb-09 22:33 
Questionhow to pass onclick parameter in zend framework Pin
rose19617-Feb-09 21:33
rose19617-Feb-09 21:33 
QuestionAJAX & PHP Pin
Bryant May14-Feb-09 8:18
Bryant May14-Feb-09 8:18 
Hello everyone,

Im having a bit of trouble with Ajax & php that Im hoping someone can help me with. I've had a search about on this but have been unable to find anything out...

My problem is this: I have set up an Ajax function which is executed on the click of a button (in context this is a password reminder system when logging in to a CMS) which opens up a short php script containing a form held within a couple of divs. Everything works as it should; the the script is called, displayed and functions correctly. But for the life of me I cannot work out how to access variables that I set in the php script.

I want to be able to say (in my Ajax function):
"<i>if this php variable holds this value, then execute this part of the Ajax function</i>"

My Ajax code looks like this:

<pre>
//Submit the password reminder form
function checkRemForm(email, div)
{
//checkValidEmail(email, div);
createObject();

if (XMLHttpRequestObject)
{
var targetDiv = document.getElementById(div);
var url = "/cms/_sql/sendPassword.php?email=" +email;

XMLHttpRequestObject.open('GET', url, true);

XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200)
{
var result = XMLHttpRequestObject.responseText;
targetDiv.innerHTML = result;
}
}
XMLHttpRequestObject.send(null);

}
}
</pre>

The php is currently just initialising a variable and looks like this:

<pre>
<?php
$email = $_GET['email'];

print $email;

//print "hi";

?>
</pre>

So the aim of this bit of code is to be able to access the value of $email in my Ajax function.

As you can imagine im just learning Ajax so I hope that i have understood how the two languages work together.

If anyone has any help or advise I would appreciate it massively.

Thanks

Bryant Smile | :)
AnswerRe: AJAX & PHP Pin
it_8x14-Feb-09 9:29
it_8x14-Feb-09 9:29 
GeneralRe: AJAX & PHP Pin
Bryant May15-Feb-09 4:17
Bryant May15-Feb-09 4:17 
GeneralRe: AJAX & PHP Pin
Perspx15-Feb-09 4:54
Perspx15-Feb-09 4:54 
GeneralRe: AJAX & PHP Pin
Bryant May16-Feb-09 1:49
Bryant May16-Feb-09 1:49 
AnswerRe: AJAX & PHP Pin
Ioannis_o519-Feb-09 6:08
Ioannis_o519-Feb-09 6:08 
GeneralRe: AJAX & PHP Pin
Bryant May19-Feb-09 6:22
Bryant May19-Feb-09 6:22 
GeneralRe: AJAX & PHP Pin
Ioannis_o519-Feb-09 6:58
Ioannis_o519-Feb-09 6:58 
GeneralRe: AJAX & PHP Pin
Bryant May19-Feb-09 7:24
Bryant May19-Feb-09 7:24 
GeneralRe: AJAX & PHP Pin
Ioannis_o519-Feb-09 7:58
Ioannis_o519-Feb-09 7:58 
GeneralRe: AJAX & PHP Pin
Bryant May19-Feb-09 8:49
Bryant May19-Feb-09 8:49 
GeneralRe: AJAX & PHP Pin
Ioannis_o519-Feb-09 9:22
Ioannis_o519-Feb-09 9:22 
GeneralRe: AJAX & PHP Pin
Bryant May19-Feb-09 10:52
Bryant May19-Feb-09 10:52 
GeneralRe: AJAX & PHP Pin
Ioannis_o519-Feb-09 22:30
Ioannis_o519-Feb-09 22:30 
GeneralRe: AJAX & PHP Pin
Bryant May19-Feb-09 23:08
Bryant May19-Feb-09 23:08 
AnswerRe: jumla in PHP Pin
EliottA14-Feb-09 7:36
EliottA14-Feb-09 7:36 
GeneralRe: jumla in PHP Pin
it_8x14-Feb-09 9:34
it_8x14-Feb-09 9:34 
QuestionFixed ip Address Pin
anishkannan13-Feb-09 18:26
anishkannan13-Feb-09 18:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.