I have an html page. when you click a button, an AJAX function will call a php page (like register.php). That page contains a form.
the URL is index.html and doesn't change to register.php because I called the PHP page through AJAX
Now that problem is: when I click the submit, I loose the html page and redirected to the register.php (the form handler is on the same page register.php).
I want the results and error messages to be displayed on the same page (index.html).

I hope the explanation was clear enough to be understood.
Thanks for the help


Ok, i got your problem. Since you would have put action in your form tag as register.php, so this is bound to go to the register.php page. Instead you can do one thing:

Set the results/error messages in the SESSIONS variable. Now call index.html page and on body onload event, call another page through ajax that reads the session messages and displays them.

Check out if this helps.

Thanks alot for the quick reply.
I was thinking of this solution but I had problems:-
1- Where should I put the code of handling the form, in the index.html page or in the register.php page?
2- If I put index.html in the action (action="index.html") and click the submit of the form, I loose the form and get only the index.html

I usually use SESSIONS when I want to pass variable between two pages or two scripts but in this case, how can I make the HTML and the PHP pages presist when I click the submit button?