This is a discussion on Passing HTTP POST information to another script - How? within the PHP Language forums, part of the PHP Programming Forums category; Dave Smithz wrote: > Hi there, > > I have a situation where I want to have multiple submit buttons ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Dave Smithz wrote:
> Hi there, > > I have a situation where I want to have multiple submit buttons on the same > form and therefore want to use a redirection php script that checks the > value associated with the submit form variable to calculate which submit was > pressed and then redirects the user to another php page accordingly. > > I used: > headers ("location:myphpscript.php") > > to do this. > > However automatically this does not pass on the information sent in the form > POST. I did start looking into reencoding the $_REQUEST into a GET string to > append to the URL, but this is a bit crude because the original form submit > uses a post and had a lot of information (some of which is also held in > $_FILES). > > So is there a better way to go about this? How can I simulate a POST? I don't know, why you have to redirect to another page. If you have some good Form handler mechanism, you can do like this (in the same page--even witout losing the clarity/readability/etc): if ( $foo->isFormSubmitted($_POST, 'deposit') ) { $foo->isValidDepositFields() and $foo->addToDepositTable(); } else if ( $foo->isFormSubmitted($_POST, 'withdraw') ) { ... } -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |