I am trying to submit form data to the database then send the client over to paypal which will use IPN to send a response back.
Right now I have the form submitting to the database, I have the IPN working, my problem is the redirecting part. I want it all to be done in with the click of one button…
My form just submits back to the current page where it validates data and adds to the database. I can’t seem to use header because data is already sent to the header.
What are my options/solutions. Simplest solution would be best but I’m open to anything at this point.
For such a simple task you would think there would be a simple solution…
Here’s my code that prints out the form:
function display_form() { ?>
<div class="culis-module">
<form action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>" method="post">
<div class="clearfix culis-module-body">
<?php
if ( $_POST['culis_add_listing'] == 'Y' && $this->no_errors()) {
$this->addto_db();
?><div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">x</button> <?php _e('Thank You, your company will be listed as soon as payment is processed.')?></div><?php
}
if ( $_POST['culis_add_listing'] == 'Y' && !$this->no_errors()) {
$this->prepare_fields('saved');
}
else {
$this->prepare_fields();
}?>
</div>
<div class="modal-footer">
<button class="btn btn-primary" type="submit" name="culis_add_listing" value="Y">Submit</button>
<button class="btn" type="submit" name="form_reset" value="Y">Clear</button>
</div>
</form>
</div>
<?php
}
Update:
Here is an example of what I’m trying to do https://stackoverflow.com/a/6753281/1445460