| | |
PHP and AJAX
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2004
Posts: 20
Reputation:
Solved Threads: 0
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
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
Hi...
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.
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.
•
•
Join Date: Nov 2004
Posts: 20
Reputation:
Solved Threads: 0
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?
Thanks
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?
Thanks
![]() |
Similar Threads
- Wanted Help ,urgently with PHP and Ajax (PHP)
- upload image through php and Ajax (PHP)
- PHP Ajax Search (PHP)
- Upload image using PHP and AJAX (PHP)
- AJAX & PHP Developer ( Full Time ) (Web Development Job Offers)
- PHP/AJAX/Javascript/Mysql - Master - NO FREELANCE (Los Angeles) (Software Development Job Offers)
Other Threads in the PHP Forum
- Previous Thread: How we can fetch value on same page in PHP???
- Next Thread: Writing to Div from a Image Link
Views: 235 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax alexa apache api array beginner beneath binary broadband broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion redirect regex remote script search select server sessions sms smtp soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube





