Hello All,
I have created a form that has 2 buttons. Button 1 sends the content of the form via email Button 2 Redirects to WorldPay's Payment page. Which works great however I would like to send the contact of the form via email aswell if Button 2 is clicked. This needs to be done before the redirect kicks in. I've tried all sorts but not had any luck. snippets of my code below
Button 1 PHP
if ($_POST['submitted']) {
$sent = wp_mail($to, $subject, $message, $headers);
if($sent) my_contact_form_generate_response("success", $message_sent); //message sent!
else my_contact_form_generate_response("error", $message_unsent);} //message wasn't sent
else //no submitted button
{
HTML Button Code
<input class="btn" type="submit" name="SUBMIT" value="Send Booking & Pay Deposit" onclick="bookingform.action='https://secure-test.worldpay.com/wcc/purchase';return true;">
<input class="btn" type="submit" name="submitted" value="Send Booking">
Cheers
Jon