I have a data information form that i need sent to an email address and then a redirect to a payment page, i have the data element sorted but cant seem to get it to forward to the payment page, any suggestions, ive been trying now for about a week.
[php]<?php
// Only process POST reqeusts.
if ($_SERVER["REQUEST_METHOD"] == "post") {
// Set the recipient email address.
$recipient = "[email protected]";
// Set the email subject.
$subject = "I WANT TO ENTER";
$eventname = $_POST['eventname'];
$emailid = $_POST['emailid'];
$title = $_POST['title'];
$name = $_POST['name'];
$address = $_POST['address'];
$town = $_POST['town'];
$county = $_POST['county'];
$postcode = $_POST['postcode'];
$phone = $_POST['phone'];
$club = $_POST['club'];
$swim = $_POST['swim'];
$tandc = $_POST['tandc'];
// Build the email content.
$email_content = "EventName: $eventname\n";
//$email_content = "Email: $email\n\n";
$email_content = "Event Name: $eventname\n";
$email_content .= "EmailId: $emailid\n";
$email_content .= "Title: $title\n";
$email_content .= "Name: $name\n";
$email_content .= "Address: $address\n";
$email_content .= "Town: $town\n";
$email_content .= "County: $county\n";
$email_content .= "Postcode: $postcode\n";
$email_content .= "Phone: $phone\n";
$email_content .= "Club: $club\n";
$email_content .= "Swim: $swim\n";
$email_content .= "Tandc: $tandc\n";
//assign site mail
$email = "[email protected]";
// Build the email headers.
$email_headers = "From: <$email>";
// Build the email headers.
$email_headers = "From: <$email>";
// Send the email.
if(@mail($recipient, $subject, $email_content, $email_headers)) {
// Set a 200 (okay) response code.
http_response_code(302);
header('location: http://www.mywebpage.org.uk/entrypay.html');
} else {
// Set a 500 (internal server error) response code.
http_response_code(302);
header('location: http://www.mywebpage.org.uk/entrypay.html');
}
/**
* inserting into database
*connect to database
* //mysql_connect("localhost", "admin", "password") or die(mysql_error());
* select database
* //mysql_select_db("users") or die(mysql_error());
* //insert email into users table
* mysql_query("INSERT INTO example (name,email,messagebody) VALUES($name,$email,$message_body) ") or die(mysql_error());
*/
} else {
// Not a POST request, set a 403 (forbidden) response code.
http_response_code(403);
header('location: http://www.mywebpage.org.uk/error404.html');
}
?>[/php]