I made a contact form a year ago, and have been re-using the code ever since.
It is just 3 text boxes but I need to add a Select option, but I have no idea how to add php to it.
This is one of the sections of the php, it's all the same other than naming so no need to post it all.
<?php
error_reporting(E_ALL ^ E_NOTICE);
if(isset($_POST['submitted'])) {
if(trim($_POST['contactFirstName']) === '') {
$nameError = 'Forgot your name!';
$hasError = true;
} else {
$name = trim($_POST['contactFirstName']);
}
if(!isset($hasError)) {
$emailTo = 'dezfouli.lila#live.com';
$subject = 'Submitted message from '.$name;
$sendCopy = trim($_POST['sendCopy']);
$body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
$headers = 'From: ' .' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
}
?>
This is one of the text boxes
<form id="contact-us" action="book.php" method="post">
<div class="formblock">
<input type="text" name="contactName" id="contactName" value="<?php if(isset($_POST['contactFirstName'])) echo $_POST['contactFirstName'];?>" class="txt requiredField" placeholder=" First Name:" />
<?php if($nameError != '') { ?>
<br /><span class="error"><?php echo $nameError;?></span>
<?php } ?>
</div>
I need to now make it work with this:
<div class="formblock">
<select name="month">
<option value="date">Month
<option value="1">January
<option value="2">February
<option value="3">March
</select>
<?php if($emailError != '') { ?>
<br /><span class="error"><?php echo $emailError;?></span>
<?php } ?>
</div>
You can access which value has been submitted by getting the value of $_POST['month']
For Example:
if (isset($_POST['month']) && $_POST['month'] != 'date') {
// add your code here
}
You also need to close your option tags as so:
<div class="formblock">
<select name="month">
<option value="date">Month</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
</select>
<?php if($emailError != '') { ?>
<br /><span class="error"><?php echo $emailError;?></span>
<?php } ?>
</div>
Related
I have got a working contact form with PHP form processing and I have added Google recapture, however. The recapture is not validating And when the form is submitted, then the user receives the following error:
This page isn’t working www.example.co.uk is currently unable to handle this request.
HTTP ERROR 500
My code is as follow:
HTML
<div class="contact">
<div class="container">
<h2>Contact US</h2>
<div class="contact-form">
<div class="col-md-8 contact-grid">
<form id="test" action="form-process.php" method="POST">
<input name="name" type="text" placeholder="Name" onfocus="this.value='';" onblur="if (this.value == '') {this.value ='name';}" required>
<br>
<input name="email" type="text" placeholder="Email" onfocus="this.value='';" onblur="if (this.value == '') {this.value ='email';}" required>
<br>
<select id="contact" name="dropdown" onchange="handleOption(this)" required>
<option value="" disabled selected>Crew/Gang</option>
<option value="NC Maphia">NC Maphia</option>
<option value="deadeye/index">Dead Eye</option>
</select><br>
<select id="contact" name="dropdown2" required>
<option value="" disabled selected>Gang</option>
<option value="Grand Theft Auto V">Grand Theft Auto V</option>
<option value="Red Dead Redemption II">Red Dead Redemption II</option>
</select><br>
<select id="contact" name="dropdown3" required>
<option value="" disabled selected>Platform</option>
<option value="Xbox One">Xbox One</option>
<option value="PS4">PS4</option>
</select><br>
<select id="contact" name="dropdown4" required>
<option value="" disabled selected>Reason For Contacting Us</option>
<option value="Joining NC Maphia">Joining NC Maphia</option>
<option value="Recruitment Requirments">Recruitment Requirments</option>
<option value="Events">Events</option>
<option value="Report A Member">Report A Member</option>
<option value="Webmaster">Webmaster</option>
<option value="General Inquiry">General Inquiry</option>
</select><br>
<input name="subject" type="text" placeholder="Subject" onfocus="this.value='';" onblur="if (this.value == '') {this.value ='subject';}">
<br>
<textarea name="message" cols="77" rows="6" placeholder="Message" onfocus="this.value='';" onblur="if (this.value == '') {this.value = 'message';}" required></textarea>
<div class="g-recaptcha" data-sitekey="Site-Key-Here"></div>
<div class="send">
<input type="submit" name="submit" value="Send" >
</div>
</form>
</div>
PHP
<?php
error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors', '1');
if(isset($_POST["submit"])) //If the form is submitted
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])):
//your site secret key
$secret = 'My-Key-Here';
//get verify response data
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
$responseData = json_decode($verifyResponse);
if($responseData->success):
{
$notification=""; //Used for catching all your messages
//Retrieve form data.
//GET - user submitted data using AJAX
//POST - in case user does not support javascript, we'll use POST instead
$errors = [];
$name = $_POST['name'];
$email = $_POST['email'];
$dropdown = $_POST['dropdown'];
$dropdown2 = $_POST['dropdown2'];
$dropdown3 = $_POST['dropdown3'];
$dropdown4 = $_POST['dropdown4'];
$subject = $_POST['subject'];
$message = $_POST['message'];
//flag to indicate which method it uses. If POST set it to 1
if ($_POST) $post=1;
//Simple server side validation for POST data, of course,
//you should validate the email
if (!$name) $errors[count($errors)] = 'Please enter your name.';
if (!$email) $errors[count($errors)] = 'Please enter your email.';
if (!$dropdown) $errors[count($errors)] = 'Please enter which crew/gang you are attempting to contact.';
if (!$dropdown2) $errors[count($errors)] = 'Please enter which game you are referring too.';
if (!$dropdown3) $errors[count($errors)] = 'Please enter which platform you are currentlyplaying on.';
if (!$dropdown4) $errors[count($errors)] = 'We need too know the reason for your message.';
if (!$message) $errors[count($errors)] = 'We need more detail on why you are contacting us.';
//if the errors array is empty, send the mail
if (!$errors) {
//recipient - change this to your name and email
$to = 'no_reply#ncmaphia.co.uk';
//sender
$from = $email;
//subject and the html message
$subject = 'Hello from ' . $name;
$message = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<p>You have recieved a message from $name using your contact form at www.ncmaphia.co.uk
<table>
<tr><td>Name: </td><td>' . $name . '</td></tr>
<tr><td>Email: </td><td>' . $email . '</td></tr>
<tr><td>Crew/Gang: </td><td>' . $dropdown . '</td></tr>
<tr><td>Game: </td><td>' . $dropdown2 . '</td></tr>
<tr><td>Platform: </td><td>' . $dropdown3 . '</td></tr>
<tr><td>Reason For Contacting Us: </td><td>' . $dropdown4 . '</td></tr>
<tr><td>Subject: </td><td>' . $subject . '</td></tr>
<tr><td>Message: </td><td>' . $message . '</td></tr>
</table>
</body>
</html>';
//send the mail
$result = mail($to, $subject, $message, $from);
//if POST was used, display the message straight away
if ($_POST) {
if ($result) header('location: thank-you.html', true, 303);
else:
$errMsg = 'Robot verification failed, please try again.';
endif;
else:
$errMsg = 'Please click on the reCAPTCHA box.';
endif;
else:
$errMsg = '';
$succMsg = '';
endif;
//else if GET was used, return the boolean value so that
//ajax script can react accordingly
//1 means success, 0 means failed
} else {
$notification.= $result;
}
//if the errors array has values
} else {
//display the errors message
for ($i=0; $i<count($errors); $i++) echo $errors[$i] . '<br/>';
$notification.= 'Back';
exit;
}
//Simple mail function with HTML header
function sendmail($to, $subject, $message, $from) {
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$result = mail($to,$subject,$message,$headers);
if ($result) return 1;
else return 0;
}
} //First If loop
?>
Thanks in advance
I created Err code so that name and radio has to be checked otherwise it can't move on to the confirmation page and send error message next to the field. Please help if I'm missing any code!
<?php
$nameErr = $charityErr = "";
$name = $charity = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"])) {
$nameErr = "Name is missing";
}
else {
$name = $_POST["name"];
}
if (!isset($_POST["charity"])) {
$charityErr = "You must select 1 option";
}
else {
$charity = $_POST["charity"];
}
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link type="text/css" href="testStyle.css" rel="stylesheet"/>
<title>Survey</title>
</head>
<body>
<div><!--start form-->
<form method="post" action="submit.php">
<input type="radio" name="charity" <?php if (isset($charity) && $charity == "1") echo "checked"; ?> value="1">1
<input type="radio" name="charity" <?php if (isset($charity) && $charity == "2") echo "checked"; ?> value="2">2
<input type="radio" name="charity" <?php if (isset($charity) && $charity == "3") echo "checked"; ?> value="3">3
<span class="error"><?php echo $charityErr;?></span>
<input type="text" name="name" placeholder="ENTER YOUR COMPANY NAME">
<span class="error"><?php echo $nameErr;?></span>
<input type="submit" name="submit" value="Submit"/>
</form>
</div><!--end form-->
</body>
</html>
My submit.php says:
/* Subject and Email Variables */
$emailSubject = 'Survey!';
$webMaster = 'myname#email.com';
/* Gathering Data Variables */
$name = $_POST ['name'];
$charity = $_POST ['charity'];
//create a new variable called $body line break, say email and variable, don't leave any space next to EOD - new variable $body 3 arrows less than greater than, beyond EOD no spaces
$body = <<<EOD
<br><hr><br>
Company Name: $name <br>
Charity: $charity <br>
EOD;
//be able to tell who it's from
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Results rendered as HTML */
$theResults = <<<EOD
<html>
blah blah
</html>
This redirects fine to submit.php page except my validation doesn't work and sends blank data.
Form code is above as:
<form method="post" action="submit.php">
<input type="radio" name="charity"
<?php if (isset($charity) && $charity == "1") echo "checked"; ?>
value="1">1
<input type="radio" name="charity"
<?php if (isset($charity) && $charity == "2") echo "checked"; ?>
value="2">2
<input type="radio" name="charity"
<?php if (isset($charity) && $charity == "3") echo "checked"; ?>
value="3">3
<span class="error"><?php echo $charityErr;?></span>
<input type="text" name="name" placeholder="ENTER YOUR COMPANY NAME">
<span class="error"><?php echo $nameErr;?></span>
<input type="submit" name="submit" value="Submit"/>
</form>
You have a syntax error here:
<?php if (isset($charity) && charity == "3") echo "checked"; ?>
You miss $ in charity var:
<?php if (isset($charity) && $charity == "3") echo "checked"; ?>
About your second question, I think that your form is a little messy.
You can use the same page to the form, validation, error management and proccesing, using this structure:
capture vars
validating
proccesing
show errors if any or success msg
render form if error or not sent
Try some like this:
<?php
//Capture POST/GET vars
$charity = $_REQUEST['charity'];
$name = $_REQUEST['name'];
$step = $_REQUEST['step'];
//You can add some sanitizing to the vars here
//Form sent if step == 1
if ($step == 1){
/*
* Validate form
*/
//Initialize error's array
$error = array();
//No charity value error
if (!$charity){
$error[] = 'You must select 1 option';
}
//Missing name error
if (!$name){
$error[] = 'Name is missing';
}
//Add any other validation here
/*
* Process form if not error
*/
if (!$error){
//Send eMail
$subject = "Your subject here";
$toemail = "<yourname#example.com>";
$bounce = "<bounce#example.com>";
$message = "
Company Name: $name<br>
Charity: $charity <br>";
$subject = '=?UTF-8?B?'.base64_encode(utf8_encode($subject)).'?=';
$headers = "From: <webform#example.com>" . "\r\n" .
"Reply-To: <info#example.com>" . "\r\n" .
"X-Mailer: PHP/" . phpversion();
mail($toemail, $subject, $message, $headers, "-f $bounce" );
//Add any other proccesing here, like database writting
}
/*
* Show errors || succsess msg on the top of the form
*/
if ($error){
unset($step); //if error, show the form
echo '<div style="color:yellow;background-color:red;">ERROR:<br>';
foreach ($error as $e){
echo '- '.$e.'<br>';
}
echo '</div><br>';
}else{
echo '<div>Form succesfully sent</div><br>';
}
}
/*
* Form rendering
*/
if (!$step){
?>
<form method="post" action="">
<input type="radio" name="charity" value="1" <?php echo ($charity == "1") ? ' checked':''; ?>>1
<input type="radio" name="charity" value="2" <?php echo ($charity == "3") ? ' checked':''; ?>>2
<input type="radio" name="charity" value="3" <?php echo ($charity == "3") ? ' checked':''; ?>>3
<input type="text" name="name" placeholder="ENTER YOUR COMPANY NAME">
<input type="hidden" name="step" value="1">
<input type="submit" name="submit" value="Submit"/>
</form>
<?php
}
I built an RSVP form for a wedding site I'm doing for a friend and I have a few drop downs in the form for attending on Friday and Saturday and for the meal option. Right now, all the fields are required, but I want to make it so the meal option drop down is only required if the person selects "yes" to attending on Friday and Saturday. So essentially the meal option drop down should only be required if the person is coming to the wedding. How do I do this in PHP?
Here is my form...
<div class="form">
<div class="validation">
<p>Oops! Please correct the highlighted fields...</p>
</div>
<div class="success">
<p>Thanks for your response!</p>
</div>
<form action="javascript:;" method="post" id="rsvp_form">
<div class="row">
<p>
<label for="first_name">First Name</label>
<input type="text" name="first_name" id="first_name" />
</p>
<p>
<select name="friday" id="friday">
<option value="">Friday Dinner?</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</p>
</div>
<div class="row">
<p>
<label for="last_name">Last Name</label>
<input type="text" name="last_name" id="last_name" />
</p>
<p>
<select name="saturday" id="saturday">
<option value="">Saturday Wedding?</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</p>
</div>
<div class="row">
<p>
<label for="rsvp_email">Email</label>
<input type="text" name="rsvp_email" id="rsvp_email" />
</p>
<p>
<select name="meal_choice" id="meal_choice">
<option value="">Meal Choice...</option>
<option value="Short Ribs">Short Ribs</option>
<option value="Red Snapper Fillet">Red Snapper Fillet</option>
<option value="Stuffed Poblano Pepper">Stuffed Poblano Pepper (Vegetarian)</option>
</select>
</p>
</div>
<input type="submit" class="button" value="RSVP" />
</form>
</div>
</div>
This is my PHP script that is working...
<?php
// Extract form contents
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$rsvp_email = $_POST['rsvp_email'];
$invite_code = $_POST['invite_code'];
$friday = $_POST['friday'];
$saturday = $_POST['saturday'];
$meal_choice = $_POST['meal_choice'];
// Validate email address
function valid_email($str) {
return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*#([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
}
// Return errors if present
$errors = "";
if($first_name =='') { $errors .= "first_name,"; }
if($last_name =='') { $errors .= "last_name,"; }
if(valid_email($rsvp_email)==FALSE) { $errors .= "rsvp_email,"; }
if($friday =='') { $errors .= "friday,"; }
if($saturday =='') { $errors .= "saturday,"; }
if($meal_choice =='') { $errors .= "meal_choice,"; }
// Send email
if($errors =='') {
$headers = 'From: <no-reply#website.com>'. "\r\n" .
'Reply-To: '.$rsvp_email.'' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$email_subject = "RSVP Form: $first_name $last_name";
$message="First Name: $first_name \n\nLast Name: $last_name \n\nRSVP Email: $rsvp_email \n\nAttending Friday: $friday \n\nAttending Saturday: $saturday \n\nMeal Choice: $meal_choice";
mail($to, $email_subject, $message, $headers);
echo "true";
} else {
echo $errors;
}
?>
Check if either $friday or $saturday are given then do the check for meal. If both are not entered then there will not be a check for meal
if($first_name =='') { $errors .= "first_name,"; }
if($last_name =='') { $errors .= "last_name,"; }
if(valid_email($rsvp_email)==FALSE) { $errors .= "rsvp_email,"; }
if($friday =='') { $errors .= "friday,"; }
if($saturday =='') { $errors .= "saturday,"; }
if( $friday != '' || $saturday != '') {
if($meal_choice =='') { $errors .= "meal_choice,"; }
}
I am creating a site on Yahoo Small Business hosting, and am having issues with the PHP contact form that I use on my WordPress install on Bluehost. The form is:
<?php
if(isset($_POST['submitted'])) {
if(trim($_POST['contactName']) === '') {
$nameError = 'Please enter your name.';
$hasError = true;
} else {
$name = trim($_POST['contactName']);
}
if(trim($_POST['email']) === '') {
$emailError = 'Please enter your email address.';
$hasError = true;
} else if (!preg_match("/^[[:alnum:]][a-z0-9_.-]*#[a-z0-9.-]+\.[a-z]{2,4}$/i", trim($_POST['email']))) {
$emailError = 'You entered an invalid email address.';
$hasError = true;
} else {
$email = trim($_POST['email']);
}
if(!isset($hasError)) {
$emailTo = get_option('tz_email');
if (!isset($emailTo) || ($emailTo == '') ){
$emailTo = 'chris#bingetech.com';
}
$subject = '[PHP Snippets] From '.$name;
$body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
$headers = 'From: '.$name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
wp_mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
} ?>
<div id="contact-wrap">
<?php if(isset($emailSent) && $emailSent == true)
{ ?>
<div class="thanks">
<p>Thanks, your email was sent successfully.</p>
</div>
<?php } else { ?>
<?php the_content(); ?>
<?php if(isset($hasError) || isset($captchaError)) { ?>
<p class="error">Sorry, an error occurred.<p>
<?php } } ?>
<form action="<?php the_permalink(); ?>" id="contactForm" method="post">
<ul class="formList">
<li>
<label class="contact_labels" for="contactName">Name:</label>
<input type="text" name="contactName" id="contactName" value="<?php if(isset($_POST['contactName'])) echo $_POST['contactName'];?>" class="required requiredField" />
<?php if($nameError != '') { ?>
<span class="error"><?=$nameError;?></span>
<?php } ?>
</li>
<li>
<label class="contact_labels" for="email">Email: </label>
<input type="email" name="email" id="email" value="<?php if(isset($_POST['email'])) echo $_POST['email'];?>" class="required requiredField email" />
<?php if($emailError != '') { ?>
<span class="error"><?=$emailError;?></span>
<?php } ?>
</li>
</ul>
<div id="subContain">
<input type="submit" id="submit" value="Ask Away!"></input>
</div>
<input type="hidden" name="submitted" id="submitted" value="true" />
</form>
</div>
I have the appropriate header calls and this does work on Bluehost, and from my research it appears Yahoo Small Business hosting can be tricky with contact forms/email. How can I get around this?
You should use some plugin instead of your own PHP code. Try Contact form 7 its completely customize-able
I've built a contact form on my wordpress site using html & php that doesn't seem to be working as it should.
Upon clicking the submit button, I'm taken to an error page saying "I don't know what you're looking for." How can I get all form submissions to be sent to my email?
<div id="contact">
<div id="contact-form" class="clearfix">
<h2><img src="<?php echo get_template_directory_uri(); ?>/img/chat.png" alt="contact frsh studio"></h2>
<?php
//init variables
$cf = array();
$sr = false;
if(isset($_SESSION['cf_returndata'])){
$cf = $_SESSION['cf_returndata'];
$sr = true;
}
?>
<ul id="errors" class="<?php echo ($sr && !$cf['form_ok']) ? 'visible' : ''; ?>">
<li id="info">There were some problems with your form submission:</li>
<?php
if(isset($cf['errors']) && count($cf['errors']) > 0) :
foreach($cf['errors'] as $error) :
?>
<li><?php echo $error ?></li>
<?php
endforeach;
endif;
?>
</ul>
<p id="success" class="<?php echo ($sr && $cf['form_ok']) ? 'visible' : ''; ?>">Thanks for reaching out! I'll be in touch shortly!</p>
<form method="post" action="process.php">
<textarea id="message" name="message" placeholder="MESSAGE" required="required" data-minlength="20"></textarea>
<input type="text" id="name" name="name" value="" placeholder="NAME" required="required" autofocus="autofocus" />
<input type="email" id="email" name="email" value="" placeholder="EMAIL" required="required" />
<select id="enquiry" name="enquiry">
<option value="refrsh">Brand REFRSH</option>
<option value="consult">Brand Consultation</option>
<option value="support">Just a Hello!</option>
</select>
<span id="loading"></span>
<input type="submit" value="Holla!" id="submit-button" />
</form>
</div>
</div><!-- end contact -->
<?php
if( isset($_POST) ){
//form validation vars
$formok = true;
$errors = array();
//submission data
$ipaddress = $_SERVER['REMOTE_ADDR'];
$date = date('d/m/Y');
$time = date('H:i:s');
//form data
$name = $_POST['name'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$enquiry = $_POST['enquiry'];
$message = $_POST['message'];
//validate form data
//validate name is not empty
if(empty($name)){
$formok = false;
$errors[] = "You have not entered a name";
}
//validate email address is not empty
if(empty($email)){
$formok = false;
$errors[] = "You have not entered an email address";
//validate email address is valid
}elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)){
$formok = false;
$errors[] = "You have not entered a valid email address";
}
//validate message is not empty
if(empty($message)){
$formok = false;
$errors[] = "You have not entered a message";
}
//validate message is greater than 20 characters
elseif(strlen($message) < 20){
$formok = false;
$errors[] = "Your message must be greater than 20 characters";
}
//send email if all is ok
if($formok){
$headers = "From: info#example.com" . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$emailbody = "<p>You have received a new message from the enquiries form on your website.</p>
<p><strong>Name: </strong> {$name} </p>
<p><strong>Email Address: </strong> {$email} </p>
<p><strong>Telephone: </strong> {$telephone} </p>
<p><strong>Enquiry: </strong> {$enquiry} </p>
<p><strong>Message: </strong> {$message} </p>
<p>This message was sent from the IP Address: {$ipaddress} on {$date} at {$time}</p>";
mail("alex#frshstudio.com","New Enquiry",$emailbody,$headers);
}
//what we need to return back to our form
$returndata = array(
'posted_form_data' => array(
'name' => $name,
'email' => $email,
'telephone' => $telephone,
'enquiry' => $enquiry,
'message' => $message
),
'form_ok' => $formok,
'errors' => $errors
);
//if this is not an ajax request
if(empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) !== 'xmlhttprequest'){
//set session variables
session_start();
$_SESSION['cf_returndata'] = $returndata;
//redirect back to form
header('location: ' . $_SERVER['HTTP_REFERER']);
}
}
Your problem might be coming from your form action, try this fixed action
<form method="post" action="http://frshstudio.com/wp-content/themes/frsh/process.php">
and move session_start(); to the top of process.php
and make sure that <?php is the only thing on the very first line of process.php
Try Change All To:
<div id="contact">
<div id="contact-form" class="clearfix">
<h2><img src="<?php echo get_template_directory_uri(); ?>/img/chat.png" alt="contact frsh studio"></h2>
<?php
$message = $_REQUEST["message"];
$name = $_REQUEST["name"];
$email = $_REQUEST["email"];
$enquiry = $_REQUEST["enquiry"];
$headers = "From:" . $email;
if($message !== null && $name !== null && $email !== null && $enquiry !== null){
mail("alex#frshstudio.com",$enquiry,$message,$headers);
echo "message sent!";
} else {
}
?>
<ul id="errors" class="<?php echo ($sr && !$cf['form_ok']) ? 'visible' : ''; ?>">
<li id="info">There were some problems with your form submission:</li>
<?php
if(isset($cf['errors']) && count($cf['errors']) > 0) :
foreach($cf['errors'] as $error) :
?>
<li><?php echo $error ?></li>
<?php
endforeach;
endif;
?>
</ul>
<p id="success" class="<?php echo ($sr && $cf['form_ok']) ? 'visible' : ''; ?>">Thanks for reaching out! I'll be in touch shortly!</p>
<form method="post" action="#">
<textarea id="message" name="message" placeholder="MESSAGE" required="required" data-minlength="20"></textarea>
<input type="text" id="name" name="name" value="" placeholder="NAME" required="required" autofocus="autofocus" />
<input type="email" id="email" name="email" value="" placeholder="EMAIL" required="required" />
<select id="enquiry" name="enquiry">
<option value="refrsh">Brand REFRSH</option>
<option value="consult">Brand Consultation</option>
<option value="support">Just a Hello!</option>
</select>
<span id="loading"></span>
<input type="submit" value="Holla!" id="submit-button" />
</form>
</div>
</div><!-- end contact -->
One more, I think you didn't have already created process.php