I have coded a form in which I am using if statement so when someone click on send button this if statement will redirects to "thanks.php" page from "career-a.php" page. In thanks.php page I have simply added bootstrap column with thanks message. But this code is not directing to other page. Can you tell me how should I solve this issue? Code on top of thanks.php:
<?php
require "header.php";
session_start();
$message=$_SESSION['msg'];
echo $message;
?>
Code for career-a.php (I have added php and html on same page so SUBMIT button is on this same page).
<?php
$page = 'careers';
require "header.php";
?>
<?php
$statusMsg='';
if(isset($_FILES["file"]["name"])){
$email = $_POST['email'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$phone = $_POST['phone'];
$option = $_POST['option'];
$message = $_POST['message'];
if(!empty($_POST['check_list'])) {
$checks = array();
foreach($_POST['check_list'] as $check) {
$checks[] = $check;
}
$check = implode('</br>•', $checks);
}
$fromemail = $email;
$subject="Tell Us About Yourself to MyGeo";
$email_message = '<h2>User Information</h2>
<p><b>First Name:</b> '.$fname.'</p>
<p><b>Last Name:</b> '.$lname.'</p>
<p><b>Email:</b> '.$email.'</p>
<p><b>Phone:</b> '.$phone.'</p>
<p><b>Interest :</br></b> •'.$check .'</p>
<p><b>Field :</b> '.$option.'</p>
<p><b>Introduce Yourself :</b> '.$message.'</p>';
$email_message.="Please find the attachment";
$semi_rand = md5(uniqid(time()));
$headers = "From: ".$fromemail;
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
if($_FILES["file"]["name"]!= ""){
$strFilesName = $_FILES["file"]["name"];
$strContent = chunk_split(base64_encode(file_get_contents($_FILES["file"]["tmp_name"])));
$email_message .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_message .= "\n\n";
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: application/octet-stream;\n" .
" name=\"{$strFilesName}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$strContent .= "\n\n" .
"--{$mime_boundary}--\n";
}
$toemail="mail@mail.com";
if(mail($toemail, $subject, $email_message, $headers)){
session_start();
$_SESSION['msg'] = $statusMsg;
header("Location: thanks.php?mailsend");
}else{
}
}
?>