Connecting Tech Pros Worldwide Help | Site Map

Multiple action with php

Newbie
 
Join Date: Oct 2009
Posts: 2
#1: Oct 15 '09
I have a form and I want to perm 2 action when I click Submit button:
1. Reload the same form
2. Call process.php script in new window with all form data

Please help how can I make this happen on one submit button
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#2: Oct 15 '09

re: Multiple action with php


I would do it the other way round. process the script (action attribute) and load the form in a new window (window.open()). of cause you can do it otherwise although that means you have to manually send the data.
TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 913
#3: Oct 15 '09

re: Multiple action with php


Dorm's right, that's the easiest way.

If you want it done your way, I think you could have the process script above the html form, just check if it was posted before it runs, and add a small javascript code (like Dorm suggested) of window.open() if it is run and successful, which will load a new window (of your success message) and the form will reload happily in you original and main window.

I am not sure why you are doing it, but separating your form handling PHP and form in separate windows seems a bit strange, and if my assumption is correct that it's a success/error/information page, you'd be better off loading that from your main page depending on PHP result.
Reply