I want the customer to pick different options from a dropdown, and then display the selected option in an email after they have submitted a form. It is supposed to send an email to me and the customer. Right now it's not sending the value from the select.
I have the following code:
<?php
if(isset($_POST['submit'])){
$to = "myemail#myemail.com"; // this is your Email address
$from = $_POST['email_address']; // this is the sender's Email address
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$address_street = $_POST['address_street'];
$phone = $_POST['phone_no'];
$quantity = $_POST['quantity'];
$select = $_POST['select'];
$subject = "Write the subject here";
$subject2 = "Write the subject here";
$message = "You have selected:" . "\n\n" . "" . $phone . $_POST['quantity'] . $_POST['select'] . $_POST['address_street'];
$message2 = "you have selected:" . "\n\n" . "" . $_POST['quantity'] . $_POST['select'] . $_POST['address_street'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "Din mail er sendt " . $first_name . " " . $last_name . " " . ". Du har valgt følgende vinduer: " . $select;
}
?>
<form action="" method="POST">
<div class="row">
<div class="large-3 medium-6 small-12 columns">
<img class="windows" src="http://spejlblank.nu/wp-content/uploads/2016/03/SPEJLBLANK_INTERIOR_V036_ENKELTFAG.jpg" width="385" height="385" alt="">
<div class="dropdown-option">
<select id="select" name="select">
<option value="" selected>VÆLG POLERINGSTYPE</option>
<option value="30">INDVENDIG + UDVENDIG</option>
<option value="60">UDVENDIG</option>
<option value="90">INDVENDIG</option>
<option value="90">FORSATS (INKL. INDVENDIG + UDVENDIG)</option>
</select>
</div>
<div class="quantity-field">
<input type="number" name="quantity" min="0" max="100" placeholder="STK.">
</div>
</div>
<div class="row contact-form-pris">
<h3 style="text-transform: uppercase;">Indtast dine oplysninger og modtag dit uforpligtende tilbud!</h3>
<div class="large-6 small-12 columns">
<label for="first_name">Fornavn *</label>
<input class="" name="first_name" id="first_name" type="text" required/>
</div>
<div class="large-6 small-12 columns">
<label for="last_name">Efternavn *</label>
<input class="" name="last_name" id="last_name" type="text" required/>
</div>
<div class="large-12 columns">
<label for="address_street">Adresse *</label>
<input class="" name="address_street" id="address_street" type="text" required/>
</div>
<div class="large-6 small-12 columns">
<label for="email_address">Email *</label>
<input class="" name="email_address" id="email_address" type="email" required/>
</div>
<div class="large-6 small-12 columns">
<label for="mobile_no">Telefon *</label>
<input class="" name="mobile_no" id="mobile_no" type="tel" required/>
</div>
<div class="large-12 columns text-center">
<input type="submit" name="submit" value="MODTAG UFORPLIGTENDE TILBUD" class="submit-pris">
</div>
</div>
</form>
Try this in your drop down
<select id="select" name="select">
<option value="VÆLG POLERINGSTYPE" selected>VÆLG POLERINGSTYPE</option>
<option value="INDVENDIG + UDVENDIG">INDVENDIG + UDVENDIG</option>
<option value="UDVENDIG">UDVENDIG</option>
<option value="INDVENDIG">INDVENDIG</option>
<option value="FORSATS (INKL. INDVENDIG + UDVENDIG)">FORSATS (INKL. INDVENDIG + UDVENDIG)</option>
</select>
In your first option you were sending blank value and other values were numbers which you probably don't want to show to make email meaningful.
Change
<option value="" selected>VÆLG POLERINGSTYPE</option>
to
<option value="" >VÆLG POLERINGSTYPE</option>
Related
i've tried to create this contact form and here is the HTML code:
<section class="contact_info_area sec_pad bg_color">
<div class="container">
<div class="row">
<div class="col-lg-3 pr-0">
<div class="contact_info_item">
<h6 class="f_p f_size_20 t_color3 f_500 mb_20">Información de contacto</h6>
<p class="f_400 f_size_15"><span class="f_400 t_color3">Email:</span> admin#doupmedia.com</p>
</div>
</div>
<div class="col-lg-8 offset-lg-1">
<div class="contact_form">
<form action="contact_process.php" class="contact_form_box" method="post" id="contactForm" novalidate="novalidate">
<div class="row">
<div class="col-lg-6">
<div class="form-group text_box">
<input type="text" id="name" name="name" placeholder="Tu Nombre">
</div>
</div>
<div class="col-lg-6">
<div class="form-group text_box">
<input type="text" name="email" id="email" placeholder="Correo Electrónico">
</div>
</div>
<div class="col-lg-12">
<div class="form-group text_box">
<input type="text" id="subject" name="subject" placeholder="Asunto">
</div>
</div>
<div class="col-lg-12">
<div class="form-group text_box">
<input type="text" id="subject" name="subject" placeholder="Teléfono">
</div>
</div>
<div class="col-lg-6">
<div class="form-group text_box">
<input type="text" id="subject" name="subject" placeholder="Página Web de la Empresa">
</div>
</div>
<div>
<script>
$('.calendar').flatpickr({
locale:"es",
minDate: "today",
"disable": [
function(date) {
// return true to disable
return (date.getDay() === 0 || date.getDay() === 6);
}
],
"locale": {
"firstDayOfWeek": 1 // start week on Monday
}
})
</script>
</div>
<div>
<label for="country">Tamaño de clientes aproximado</label>
<select id="clientes" name="country">
<option value="australia">0 - 1k</option>
<option value="canada">1k - 10k</option>
<option value="usa">100k - 1M</option>
<option value="usa">1M - 10M</option>
</select>
<label for="country">¿A qué hora va bien que te llamemos?</label>
<select id="clientes" name="country">
<option value="australia">10:00 - 11:00</option>
<option value="canada">11:00 - 12:00</option>
<option value="usa">12:00 - 13:00</option>
<option value="usa">13:00 - 14:00</option>
<option value="usa">16:00 - 17:00</option>
<option value="usa">17:00 - 18:00</option>
<option value="usa">18:00 - 19:00</option>
<option value="usa">19:00 - 20:00</option>
</select>
</div>
<div class="col-lg-12">
<div class="form-group text_box">
<textarea name="message" id="message" cols="30" rows="10" placeholder="Deja tu mensaje..."></textarea>
</div>
</div>
</div>
<div class="custom-control custom-switch custom-switch-light">
<input type="checkbox" class="custom-control-input" id="customSwitch2" required="">
<label class="custom-control-label" for="customSwitch2">He leído y acepto la política de privacidad y protección de datos.</label>
</div>
<br>
<button type="submit" class="btn_three" >Enviar Mensaje</button>
</form>
<div id="success">¡En breves nos pondremos en contacto contigo!</div>
<div id="error">Opps! Ha habido un error. Porfavor inténtelo de nuevo.</div>
</div>
</div>
</div>
</div>
</section>
And when I try to edit the contact.php which is called contact_process.php it jumps a white page with thhat error: Cannot POST / contact_process.php
If somebody knows the answer please help.
<?php
$to = "runjiebusiness#gmail.com";
$from = $_REQUEST['email'];
$name = $_REQUEST['name'];
$name2 = $_REQUEST['name2'];
$csubject = $_REQUEST['subject'];
$cmessage = $_REQUEST['message'];
$headers = "From: $from";
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$subject = "You have a message from your Doup Media.";
$logo = '';
$link = '#';
$body = "<!DOCTYPE html><html lang='en'><head><meta charset='UTF-8'><title>Bixcoin Master Mail</title></head><body>";
$body .= "<table style='width: 100%;'>";
$body .= "<thead style='text-align: center;'><tr><td style='border:none;' colspan='2'>";
$body .= "<a href='{$link}'><img src='{$logo}' alt=''></a><br><br>";
$body .= "</td></tr></thead><tbody><tr>";
$body .= "<td style='border:none;'><strong>Name:</strong> {$name}</td>";
$body .= "<td style='border:none;'><strong>Email:</strong> {$from}</td>";
$body .= "</tr>";
$body .= "<tr><td style='border:none;'><strong>Subject:</strong> {$csubject}</td></tr>";
$body .= "<tr><td></td></tr>";
$body .= "<tr><td colspan='2' style='border:none;'>{$cmessage}</td></tr>";
$body .= "</tbody></table>";
$body .= "</body></html>";
$send = mail($to, $subject, $body, $headers);
?>
the _REQUEST variable is missing the field "name2". so the PHP script fails:
$name2 = $_REQUEST['name2'];
This means you need to add an input in your form for name2 or remove this in your PHP script.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
complete newbie in this.
a guy sent me a code for a contact form. the form looks nice, however it is not functioning(pressing submit does nothing). I guessed that the relevant section from the whole code is the one I pasted below.
how do I turn this into a working form?
<!-- Content -->
<div id="main">
<div class="wrapper cf">
<div class="content contact-block cf">
<h2><i>Contact</i> Us</h2>
<div class="sidebar-form cf">
<div class="row"><input id="firstname" type="text" name="fname" value="" placeholder="FIRST NAME" /></div>
<div class="row"><input id="lastname" type="text" name="lname" value="" placeholder="LAST NAME" /></div>
<div class="row"><input id="email" type="text" name="email" value="" placeholder="EMAIL ADDRESS" /></div>
<div class="row"><input id="order" type="text" name="order" value="" placeholder="ORDER NUMBER" /></div>
<div class="row">
<select id="subject" name="subject">
<option value="0" selected="selected">SUBJECT</option>
<option value="1">Received Error Message</option>
<option value="2">Login Issues</option>
<option value="3">Billing Questions</option>
<option value="4">Membership Questions</option>
<option value="5">Privacy Issues</option>
<option value="6">Report Abuse</option>
<option value="7">Legal Department</option>
<option value="8">Other</option>
<option value="9">How Do I Access Reports I've Run</option>
<option value="10">Account Cancellation</option>
</select>
</div>
<div class="row"><textarea name="comments" cols="" rows="" placeholder="COMMENTS OR QUESTIONS"></textarea></div>
<div class="row"><input type="submit" name="submit" value="Submit" /></div>
</div>
</div>
</div>
</div>
<!-- // Content -->
This is the contactengine.php file
<?php
$EmailFrom = "mymail#gmail.com";
$EmailTo = "mymail#gmail.com";
$Subject = "Nice & Simple Contact Form by CSS-Tricks";
$fname = Trim(stripslashes($_POST['fname']));
$lname = Trim(stripslashes($_POST['lname']));
$Email = Trim(stripslashes($_POST['Email']));
$order = Trim(stripslashes($_POST['order']));
$subject = Trim(stripslashes($_POST['subject']));
$comments = Trim(stripslashes($_POST['comments']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $fname;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $lname;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "order: ";
$Body .= $order;
$Body .= "\n";
$Body .= "subject: ";
$Body .= $subject;
$Body .= "\n";
$Body .= "comments: ";
$Body .= $comments;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
Add this code inside form tag.
<!-- Content -->
<form method="post" action="">
<div id="main">
<div class="wrapper cf">
<div class="content contact-block cf">
<h2><i>Contact</i> Us</h2>
<div class="sidebar-form cf">
<div class="row"><input id="firstname" type="text" name="fname" value="" placeholder="FIRST NAME" /></div>
<div class="row"><input id="lastname" type="text" name="lname" value="" placeholder="LAST NAME" /></div>
<div class="row"><input id="email" type="text" name="email" value="" placeholder="EMAIL ADDRESS" /></div>
<div class="row"><input id="order" type="text" name="order" value="" placeholder="ORDER NUMBER" /></div>
<div class="row">
<select id="subject" name="subject">
<option value="0" selected="selected">SUBJECT</option>
<option value="1">Received Error Message</option>
<option value="2">Login Issues</option>
<option value="3">Billing Questions</option>
<option value="4">Membership Questions</option>
<option value="5">Privacy Issues</option>
<option value="6">Report Abuse</option>
<option value="7">Legal Department</option>
<option value="8">Other</option>
<option value="9">How Do I Access Reports I've Run</option>
<option value="10">Account Cancellation</option>
</select>
</div>
<div class="row"><textarea name="comments" cols="" rows="" placeholder="COMMENTS OR QUESTIONS"></textarea></div>
<div class="row"><input type="submit" name="submit" value="Submit" /></div>
</div>
</div>
</div>
</div>
<!-- // Content -->
</form>
I have a simple contact form, the html is this part:
<!-- CONTACT FORM -->
<form id="contact-form" name="contactform" class="row">
<!-- CONTACT FORM IMPUT -->
<div id="input_name" class="col-md-12">
<input type="text" name="name" id="name" class="form-control" placeholder="Il tuo nome">
</div>
<div id="input_email" class="col-md-12">
<input type="text" name="email" id="email" class="form-control" placeholder="Email">
</div>
<div id="input_subject" class="col-md-12">
<input type="text" name="subject" id="subject" class="form-control" placeholder="Numero di telefono">
</div>
<div id="input_message" class="col-md-12">
<textarea class="form-control" name="message" id="message" rows="6" placeholder="Il tuo messaggio..."></textarea>
</div>
<div class="col-md-12 sinistra"><br>Quale servizio ti interessa?<br><br></div>
<div class="col-md-4 sinistra">
<input type="radio" name="tipologia" value="standard"> Standard<br>
</div>
<div class="col-md-4 sinistra">
<input type="radio" name="tipologia" value="avanzato"> Avanzato<br>
</div>
<div class="col-md-4 sinistra">
<input type="radio" name="tipologia" value="deluxe"> Deluxe<br>
</div>
<div class="col-md-12"><br></div>
<!-- CONTACT FORM SUBMIT BUTTON -->
<div id="form_btn" class="col-md-12">
<input type="submit" value="Invia" id="submit" class="btn btn-small btn-blue">
</div>
<!-- CONTACT FORM MESSAGE -->
<div class="col-md-12 contact-form-msg">
<span class="loading"></span>
</div>
</form>
with this php file
<?
$name = $_REQUEST["name"];
$email = $_REQUEST["email"];
$subject = $_REQUEST["subject"];
$msg = $_POST["msg"];
$tipologia = $_POST['tipologia'] ;
$to = "info#gmail.com";
if (isset($email) && isset($name) && isset($msg) ) {
$email_subject = "$name ha inviato una richiesta di ordine";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "Da: ".$name." <".$email.">\r\n"."Reply-To: ".$email."\r\n" ;
$msg = "Da: $name<br/> Email: $email <br/> Telefono: $subject <br/>
Tipologia: $tipologia <br/> Messaggio: $msg";
$mail = mail($to, $email_subject, $msg, $headers);
if($mail)
{
echo 'success';
}
else
{
echo 'failed';
}
}
?>
but I have a problem with radio input, the form works but doesn't pass the value of radio to email, so the email has the Tipologia without the radio selected for the form... What could be the error?
<form> defaults to a GET method if POST isn't implied.
You're using two POST arrays.
So... use a POST method and all POST arrays.
Either way, everything must match.
You should also check if the radio buttons are set or not, or any other you wish to include.
I am attempting to send an email by filling out a contact form. Both my html form and php file are included below. Once I fill out the form, it notifies me that the email has been sent. However, I never receive an email; I cannot figure out what i am doing wrong.
This is my html form:
<div class="row" style="padding-top:27px">
<div class="large-6 column">
<form action="mail.php" method="POST" data-abide>
<div class="name-field">
<label>Your name*</label>
<input type="text" required pattern="[a-zA-Z]+">
<small class="error">Name is required and must be a string.</small>
</div>
<div class="email-field">
<label>Email*</label>
<input type="email" required>
<small class="error">An email address is required.</small>
</div>
<div>
<label> Subject* </label>
<!--<input class="error" type="subject" name="subject" value="" size="40" required>
<small class="error">Invalid entry</small>-->
<select id="customDropdown1" class="medium error" required="" data-invalid="">
<option value="">Select an option...</option>
<option value="first">Green Chilies</option>
<option value="second">Raisins</option>
<option value="third">Panko bread crumbs</option>
<option value="fourth">Assistance</option>
</select>
<small class="error">Invalid entry</small>
</div>
</div>
<div class="large-6 column">
<!-- <label> Message </label>
<textarea class="error" placeholder="Message..." id="info" class="message" name="message" cols="70" rows="60" size="90" requi></textarea><br>-->
<label> Message </label>
<textarea class="error" placeholder="Message..." ></textarea>
<small class="error">Invalid entry</small>
<div>
<input style="float:right;" type="submit" value="Submit">
<img style="visibility: hidden;">
</div>
</form>
This is my php file:
<?php
$to = "education#arcdna.com";
$subject = $_POST['subject'];
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
mail($to , $subject, $message, $email);
echo "Thank you for using our mail form";
?>
UPDATED FILES:
HTML:
<div class="name-field">
<label>Your name*</label>
<input type="text" name="name" required pattern="[a-zA-Z]+">
<small class="error">Name is required and must be a string.</small>
</div>
<div class="email-field">
<label>Email*</label>
<input type="email" name="email" required>
<small class="error">An email address is required.</small>
</div>
<div>
<label> Subject* </label>
<!--<input class="error" type="subject" name="subject" value="" size="40" required>
<small class="error">Invalid entry</small>-->
<select id="customDropdown1" class="medium error" name="subject" required="" data-invalid="">
<option value="">Select an option...</option>
<option value="first">Green Chilies</option>
<option value="second">Raisins</option>
<option value="third">Panko bread crumbs</option>
<option value="fourth">Assistance</option>
</select>
<small class="error">Invalid entry</small>
</div>
<!-- End Contact Form -->
</div>
PHP:
<?php
$to = "education#arcdna.com";
$subject = $_POST['subject'];
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
mail($to , $subject, $message, $email);
echo "Thank you for using our mail form";
?>
None of your input fields have a name associated with them, so you're likely getting empty data in your POST. The 'email' value within $_POST['email'] refers to an input field's name.
Specifically, you're not getting an email address from your form, so the email is not sending to anyone.
For instance, you'll need:
<input type="email" name="email" required>
The fourth parameter of mail() is additional headers. Which is where your "FROM" information should go.
Refer here:
http://php.net/manual/en/function.mail.php
for what should go there.
here's one example
$headers = 'From: webmaster#example.com' . "\r\n" .
'Reply-To: webmaster#example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
This question gets asked all the time, but I can't figure out why mine isn't working. I have a form that redirects to itself. If PHP decides it is submitted, there is a success/failure message and it displays the user input as the default value and disables the fields: using phpinfo I can see that the form is being submitted, but this first conditional doesn't work. I've tried a couple of versions, but no luck. It's weird because it sends the email
Specifically, the result and disable functions don't display their code after the form has been sent.
<?php
function clean($data) {
$data = trim(stripslashes(strip_tags($data)));
return $data;
}
function result(){
if($sent) echo $result;
}
function disable($field){
if($sent){
if($field != null){
$ret .= $field . '", disabled, placeholder!="';
}
$ret .= '", disabled, placeholder!="';
echo $ret;
}
}
function option($item){
$ret = "<option>";
if($sent){
if($eventType == $item){
$ret = "<option selected>";
}
}
$ret .= $item . "</option>";
echo $ret;
}
if(isset($_POST['name'])){
$sent = TRUE;
$result = null;
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$eventDate = $_POST['eventDate'];
$eventTime = $_POST['eventTime'];
$eventLength = $_POST['eventLength'];
$eventLocation = $_POST['eventLocation'];
$eventType = $_POST['eventType'];
$message = $_POST['message'];
$recipient = "";
$subject = " Form Submission";
$mailheader = "From: \r\n";
$formcontents = "You received this e-mail message through your website: \n\n";
$formcontents .= "Name: " . clean($name) . "\r\n";
$formcontents .= "Phone: " . clean($phone) . "\r\n";
$formcontents .= "Email: " . clean($email) . "\r\n";
$formcontents .= "Event Date: " . clean($eventDate) . "\r\n";
$formcontents .= "Event Time: " . clean($eventTime) . "\r\n";
$formcontents .= "Event Length: " . clean($eventLength) . "\r\n";
$formcontents .= "Event Location: " . clean($eventLocation) . "\r\n";
$formcontents .= "Event Type: " . clean($eventType) . "\r\n";
$formcontents .= "Message: " . clean($message) . "\r\n";
$formcontents .= "\r\n";
$formcontents .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n";
$formcontents .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\r\n";
// Send mail
if(mail($recipient, $subject, $formcontents, $mailheader)){;
$result = '<h3 class="alert alert-success"> Thank you, your form was successfully sent and I will contact you shortly.</h3>';
} else {
$result = '<h3 class="alert alert-error"> Your mail could not be sent at this time.</h3>';
}
}
?>
<form action="contact.php" method="POST" class="form-horizontal span4">
<fieldset>
<legend>
<h2>Or send me a message. </h2>
</legend>
<p class="help-block">None of the fields are required, but the more information I have about your event, the more detailed I can be in my response.</p>
<legend class="help-block">Your Details</legend>
<div class="control-group">
<label for="name" class="control-label">Your Name</label>
<div class="controls">
<input id="name" type="text" name="name" placeholder="<?php disable($name); ?>" class="input-xlarge"/>
</div>
</div>
<div class="control-group">
<label for="phone" class="control-label">Your Contact Number</label>
<div class="controls">
<input id="phone" type="tel" name="phone" placeholder="<?php disable($phone); ?>" class="input-xlarge"/>
</div>
</div>
<div class="control-group">
<label for="email" class="control-label">Your Email</label>
<div class="controls">
<input id="email" type="email" name="email" placeholder="<?php disable($email); ?>" class="input-xlarge"/>
</div>
</div>
<legend class="help-block">Your Event </legend>
<div class="control-group">
<label for="eventDate" class="control-label">Your Event's Date</label>
<div class="controls">
<input id="eventDate" type="date" name="eventDate" placeholder="<?php disable($eventDate); ?>" class="input-xlarge"/>
</div>
</div>
<div class="control-group">
<label for="eventTime" class="control-label">Your Event's Start Time</label>
<div class="controls">
<input id="eventTime" type="time" name="eventTime" placeholder="<?php disable($eventTime); ?>" class="input-xlarge"/>
</div>
</div>
<div class="control-group">
<label for="eventLength" class="control-label">Your Event's Length</label>
<div class="controls">
<input id="eventLength" type="text" name="eventLength" placeholder="<?php disable($eventLength); ?>" class="input-xlarge"/>
</div>
</div>
<div class="control-group">
<label for="eventLocation" class="control-label">Your Event's Location</label>
<div class="controls">
<input id="eventLocation" type="text" name="eventLocation" placeholder="<?php disable($eventLocation); ?>" class="input-xlarge"/>
</div>
</div>
<div class="control-group">
<label for="eventType" class="control-label">What Kind of Event</label>
<div class="controls">
<select id="eventType" name="eventType" placeholder="<?php disable($eventType); ?>"><?php option("Charity Event"); option("Expo/Trade Show"); option("Personal Event"); option("Other"); ?></select>
</div>
</div>
<div class="control-group">
<label for="message" class="control-label">Other comments or the best time to reach you.</label>
<div class="controls">
<textarea id="message" name="message" rows="10" placeholder="<?php disable($message); ?>" class="input-xxlarge"></textarea>
</div>
</div>
<div class="form-actions">
<button type="submit" name="submit" placeholder="<?php disable(null); ?>" class="btn btn-primary">Send Message</button>
</div>
</fieldset>
</form>
You have to import your global variables into function scope, like:
function result(){
global $sent, $result;
if($sent) echo $result;
}
..in functions disable() and option(), too.
if(isset($_POST['name'])){
should be
if(isset($_POST['submit'])){