$location ="/contact.php";
if(isset($_POST[$form_names['email']], $_POST[$form_names['subject']], $_POST[$form_names['mess']])){
if($csrf->check_valid('post')){
$email = trim(htmlspecialchars($_POST[$form_names['email']]));
$subject = trim(htmlspecialchars($_POST[$form_names['subject']]));
$mess = trim(htmlspecialchars($_POST[$form_names['mess']]));
if ($email == '' && $subject == '' && $mess == ''){
// $message = "Success";
$headers = "From: {$email}\r\n".
"Content-Type: text/html; charset=ISO-8859-1\r\n";
$current_ip = $_SERVER['REMOTE_ADDR'];
$html_message = nl2br($mess);
$sub = "CONTACT FORM: ".$subject;
//send email
$to = SITE_EMAIL;
$the_mess = "IP: ".$current_ip." <br />
FROM: ".$email."<br />
MESSAGE: <p />"."$html_message";
mail($to, $sub, $the_mess, $headers);
$message = "<div class='alert alert-success'><button type='button' class='close' data-dismiss='alert'>x</button>Thank you, your message has been sent successfully.</div>";
} else {
$message = "<div class='alert alert-danger'><button type='button' class='close' data-dismiss='alert'>x</button>Please complete all required fields.</div>";
}
}
And form:
<form action="<?php echo $location; ?>" method="post" class="form-horizontal" enctype="multipart/form-data">
<label for="subject">Choose Department:</label><br>
<select id="subject" name="<?php echo $form_names['subject']; ?>" class="form-control">
<option value="activation">Account activation</option>
<option value="suspension">Account suspension</option>
<option value="auctions">Auctions</option>
<option value="complaint">Complaints</option>
<option value="others">Others</option>
</select>
<br />
<label for="email">Email Address</label>
<input type="text" class="form-control" name="<?php echo $form_names['email']; ?>" autocomplete="off" value="<?php echo htmlspecialchars($email); ?>" placeholder="Enter your Email Address">
<br />
<label for="email">Please describe your problem</label>
<textarea type="text" class="form-control" style="height:111px;" name="<?php echo $form_names['mess']; ?>" placeholder="Your Message" required="required"><?php echo htmlspecialchars($mess); ?></textarea>
<input class="btn btn-danger" type="submit" name="submit" value="Send Message" />
</form>
When I submit the form, it outputs the second $message:
Please complete all required fields.
I cannot find the issue here. I tried print_r(error_get_last()); and it does not show any errors. Any help would be much appreciated. Thank you very much!
Your condition is if ($email == '' && $subject == '' && $mess == ''){, this means that the mail is sent only if all the fields are empty.
I'm assuming the correct condition should be like if ($email != '' && $subject != '' && $mess != ''){
Related
Update:
I've added echo $errors to the end of my code. Now I am getting that all fields are required although all are filled:
} else {
echo $errors;
}
I've created a simple php e-mail form with this example (link). And jQuery form validator (link).
Now what I get after submiting a form is just a empty "contact-form-handler.php" page.
You can see the form live at: mantasmilka.com/#contactPage
What could be the problem? Below is my code.
contact-form-handler.php
<?php
$errors = '';
$myemail = 'mantas#mantasmilka.com';//<-----Put Your email address here.
if(empty($_POST['infoname']) ||
empty($_POST['infocompany']) ||
empty($_POST['infoemail']) ||
empty($_POST['infophone']) ||
empty($_POST['infodescription'])
)
{
$errors .= "\n Error: all fields are required";
}
$jobtype = $_POST['jobtype'];
$budget = $_POST['budget'];
$location = $_POST['location'];
$infoname = $_POST['infoname'];
$infocompany = $_POST['infocompany'];
$infoemail = $_POST['infoemail'];
$infophone = $_POST['infophone'];
if (isset($_POST['infodescription'])) {
$infodescription = $_POST['infodescription'];
}
if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*#[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
$infoemail))
{
$errors .= "\n Error: Invalid email address";
}
if( empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission: $name";
$email_body = "You have received a new message. ".
" Here are the details:\n Jobtype: $jobtype \n Budget: $budget \n Location: $location \n Name: $infoname \n Company: $infocompany \n E-mail: $infoemail \n Phone: $infophone \n ".
"Message \n $infodescription";
$headers = "From: $myemail\n";
$headers .= "Reply-To: $infoemail";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
// header('Location: http://www.mantasmilka.com/index.php');
header('Location: index.php');
exit();
} else {
echo $errors;
}
?>
my form in index.php:
<form id="contactform" method="post" name="contact_form" action="contact-form-handler.php">
<div class="left">
<fieldset class="jobtype">
<legend>Job type</legend>
<input type="radio" name="jobtype" id="project" value="project" required>
<label for="project">Project</label>
<input type="radio" name="jobtype" id="part-time" value="part-time" >
<label for="part-time">Part-time</label>
<input type="radio" name="jobtype" id="full-time" value="full-time" >
<label for="full-time">Full-time</label>
</fieldset>
<fieldset class="budget">
<legend>Budget</legend>
<input type="radio" name="budget" id="budget5k" value="budget5k" required>
<label for="budget5k">5k € ></label>
<input type="radio" name="budget" id="budget10k" value="budget10k" >
<label for="budget10k">5k - 10k €</label>
<input type="radio" name="budget" id="budget15k" value="budget15k" >
<label for="budget15k">15k € <</label>
</fieldset>
<fieldset class="location">
<legend>Location</legend>
<input type="radio" name="location" id="locremote" value="locremote" required>
<label for="locremote">Remote</label>
<input type="radio" name="location" id="loclocal" value="loclocal" >
<label for="loclocal">Local with relocation</label>
</fieldset>
</div>
<div class="right">
<fieldset class="contactinfo">
<legend>Your Contact Info</legend>
<div class="input-holder">
<input type="text" name="infoname" id="infoname" value="" required data-validation="alphanumeric">
<label for="infoname">Name</label>
</div>
<div class="input-holder">
<input type="text" name="infocompany" id="infocompany" value="" required data-validation="alphanumeric">
<label for="infocompany">Company</label>
</div>
<div class="input-holder">
<input type="text" name="infoemail" id="infoemail" value="" required data-validation="email">
<label for="infoemail">E-mail</label>
</div>
<div class="input-holder">
<input type="text" name="infophone" id="infophone" value="" required data-validation="number">
<label for="infophone">Phone</label>
</div>
<div class="input-holder textarea">
<textarea name="infodescription" form="contact_form" rows="4" required></textarea>
<label for="infodescription">Message</label>
</div>
<div class="input-holder submit">
<input type="submit" name="submit" value="Submit" required/>
</div>
</fieldset>
</div>
</form>
text field should look like this don't put form tag in here
<textarea name="infodescription" rows="4" required></textarea>
in php make the if statement like this the first ( opens the if statement the last ) closes it and take not of how i used the other brackets
if(
(empty($_POST['infoname'])) ||
(empty($_POST['infocompany'])) ||
(empty($_POST['infoemail'])) ||
(empty($_POST['infophone'])) ||
(empty($_POST['infodescription']))
)
{
$errors .= "\n Error: all fields are required";
}
The efficient way to solve the problem is:
$('#contactform').submit(function(ev) {
ev.preventDefault();
if($('#infodescription').val() == '')
{
alert('Description is required');
return false;
}
//add other validation
this.submit(); // If all the validations succeeded
});
By this you can avoid the unwanted server load.
I bought a WP theme a few months ago and it works great! I am trying to edit the contact.php / sendmail.php
I have successfully added in a field, it shows up in the body of the email and sends correctly. However, I am have a lot of trouble getting the new field "school(s) of interest" to highlight properly (with hidden text) when the field hasn't been filled. The contact form in question can be found here: http://www.northbrookmontessori.org/school-tours/
sendmail.php
<?php
//validate fields
$errors = '';
//has the form's submit button been pressed?
if( !empty( $_POST['myformsubmit'] ) )
{
// HAS THE SPAM TRAP FIELD BEEN FILLED IN?
if( !empty( $_POST['favouriteColour'] ) )
{
exit;
}
$myemail = $_POST['youremail'];
$thankyou = $_POST['thankyou'];
$formerror = $_POST['formerror'];
if(empty($_POST['name']) ||
empty($_POST['school']) ||
empty($_POST['email']) ||
empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
}
$name = $_POST['name'];
$school = $_POST['school'];
$email_address = $_POST['email'];
$message = $_POST['message'];
if (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*#[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address)) { $errors .= "\n Error: Invalid email address"; } //send email
if( empty($errors))
{
$to = $myemail;
$email_subject = "Contact form submission from $name";
$email_body = "$name has sent you this email through the contact form: \n \n".
"Name: $name \n".
"School(s) of interest: $school \n".
"Email: $email_address \nMessage: \n\n$message";
$headers = "From: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: ' . $thankyou);
}
else {
header('Location: ' . $formerror);
}
}
?>
contact.php
<!-- ***** CONTACT -->
<div class="block_wrapper <?php if($bb_animation == 'yes'){ echo 'animation' . $anim1_number; ?> animated <?php } ?><?php echo ' '.$custom_width; ?>">
<div class="box_full<?php if($margin_top != ''){echo ' ' . $margin_top;} ?><?php if($margin_bottom != ''){echo ' ' . $margin_bottom;} ?><?php if($custom_classes != NULL){echo ' ' . $custom_classes;} ?>">
<form id="theform" class="form mt35" method="post" action="<?php echo get_template_directory_uri(); ?>/sendmail.php">
<p class="hRow">
<label for="favouriteColour">Favourite colour (do not fill in)</label>
<span><input type="text" name="favouriteColour" id="favouriteColour" value="" /></span>
</p>
<input type="hidden" name="youremail" id="youremail" value="<?php if(!empty($contact_email)){echo $contact_email;} ?>" />
<input type="hidden" name="thankyou" id="thankyou" value="<?php if(!empty($contact_thankyou)){echo $contact_thankyou;} ?>" />
<input type="hidden" name="formerror" id="formerror" value="<?php if(!empty($contact_error)){echo $contact_error;} ?>" />
<p class="name validated">
<label for="name">Name</label>
<span><input type="text" name="name" id="name" /></span>
</p>
<p class="school validated">
<label for="school">School(s) of interest</label>
<span><input type="text" name="school" id="school" /></span>
</p>
<p class="email validated">
<label for="email">E-mail</label>
<span><input type="text" name="email" id="email" /></span>
</p>
<p class="text validated">
<label for="message">Message</label>
<textarea name="message" id="message" rows="50" cols="100"></textarea>
</p>
<p class="submit">
<input type="submit" class="buttonmedium float_r" name="myformsubmit" value="Send Email" />
</p>
<p id="error">* There were errors on the form, please re-check the fields.</p>
</form>
</div>
<div class="clear"></div>
</div><!-- ***** END CONTACT -->
you need to go to the file:
http://www.northbrookmontessori.org/wp-content/themes/modular/js/settings.js?ver=4.2.2
and edit the top where it says:
// Place ID's of all required fields here.
add in school
I've created an email form that is supposed to be sent to two different email addresses depending on which check box is selected. But am having real trouble trying to make it work, Let me show you what I'm tying to do.
Baring in mind the form actually works great it's just the to email via the checkbox that's failing me.
Please Help!
This is the Form section:
<div id="respond">
<?php echo $response; ?>
<form id="commentForm" method="post" action="#contact2">
<div>
<small>Name:</small>
<input type="text" name="message_name" placeholder="Enter you name..." value="<?php echo $_POST['message_name']; ?>">
<small>Department:</small>
<!-- EDIT || replaced type=checkbox with type=radio -->
<input type="radio" name="sales" value="sales#h-s-c.co.uk" checked/>
<input type="radio"name="lettings" value="lettings#h-s-c.co.uk" />
<small>Email:</small>
<input type="text" name="message_email" placeholder="somebody#email.co.uk" value="<?php echo $_POST['message_email']; ?>">
<small>Phone:</small>
<input class="" type="tel" name="phone_number" placeholder="07912 208 936" value="<?php echo $_POST['phone_number']; ?>">
</div>
<div style="float:right;">
<small>Message:</small>
<textarea type="text" name="message_text" placeholder="I would like further information on..."><?php echo $_POST['message_text']; ?></textarea>
</div>
<small>Human Verification:</small><br>
<input type="text" style="width: 60px;" name="message_human" placeholder="2"> + 3 = 5</label>
<input type="hidden" name="submitted" value="1">
<input class="" type="submit" value="submit"/>
</form>
</div>
Then the php to send the form looks like this:
<?php
//Include email and to name
$admin_email = $_POST[$email_address];//EDIT || changed to new value $email_address
$block = "Test";
//Remove this section
//foreach($_POST['check'] as $value) {
// $checkbox .= "$value\n";
//}
?>
<?php
//response generation function
$response = "";
//function to generate response
function generate_response($type, $message){
global $response;
if($type == "success") $response = "<div class='success'>{$message}</div>";
else $response = "<div class='error'>{$message}</div>";
}
//response messages
$not_human = "Human verification incorrect.";
$missing_content = "Please supply all information.";
$email_invalid = "Email Address Invalid.";
$message_unsent = "Message was not sent. Try Again.";
$message_sent = "Thanks! Your message has been sent.";
//user posted variables
$name = $_POST['message_name'];
$email = $_POST['message_email'];
$phone = $_POST['phone_number'];
$message = $_POST['message_text'];
$human = $_POST['message_human'];
//php mailer variables
$to = $admin_email;
$subject = "Someone sent a message from {$block}";
$headers = 'From: '. $email . "\r\n" .
'Reply-To: ' . $email . "\r\n";
$tel = 'Contact no: ' . $phone;
if(!$human == 0){
if($human != 2) generate_response("error", $not_human); //not human!
else {
//validate email
if(!filter_var($email, FILTER_VALIDATE_EMAIL))
generate_response("error", $email_invalid);
else //email is valid
{
//validate presence of name and message
if(empty($name) || empty($message)){
generate_response("error", $missing_content);
}
else //ready to go!
{
$sent = mail($to, $subject, $message . $tel , $headers);
if($sent) generate_response("success", $message_sent); //message sent!
else generate_response("error", $message_unsent); //message wasn't sent
}
}
}
}
else if ($_POST['submitted']) generate_response("error", $missing_content);
?>
When the form is submitted checkboxes does not provide their value to the server. Check boxes only have a value on if they are checked. use a radiobutton or a select box instead.
Checkbox does not send string value, just boolean values for checkbox identifier.
Add in code a new condition
If CHECKED then use email else blank for both checkbox.
<?php
//Include email and to name
$admin_email = $_POST[$checkbox]; // no element with name 'checkbox'
$block = "Test";
// no element with name 'check'
foreach($_POST['check'] as $value) {
$checkbox .= "$value\n";
}
?>
these are main issue.
If you want to send mail to any one from the two options then use select, and in value of option provide email id
//HTML CODE
<select name="to_email">
<option value="sales#xxxx">Sales</option>
<option value="lettings#xxxx">Lettings</option>
</select>
PHP CODE
<?php
$admin_email = $_POST['to_email']; // this will get you the selected email id
?>
let me know if you have any queries.
*<form id="requestform" name="requestform" action="enquiry.php" class="col-xs-12" method="post">
<div class="form-wrapper">
<div class="col-xs-12">
<div class="field col-xs-6">
<label class="formlabel"> Email </label>
<input class="textfield" data-required="true" type="email" name="email" />
</div>
<div class="field col-xs-6">
<label class="formlabel"> Phone </label>
<input class="textfield" data-required="true" type="text" name="phone" />
</div>
</div>
<div class="clear"></div>
<div class="col-xs-12">
<div class="field col-xs-6">
<label class="formlabel"> Details </label>
<textarea class="textfield textarea" type="textarea" data-required="true" name="details"/></textarea >
</div>
<div class="field emailfunc col-xs-6">
<label class="formlabel"> What can we help you with ? </label>
<span>
<input name="interested" id="logistics" value="logistics" onchange="" type="checkbox">
<label class="inline" >Logistics</label>
</span>
<span>
<input name="interested" id="sales" value="sales" onchange="" type="checkbox">
<label class="inline" >Sales</label>
</span>
<span>
<input name="interested" id="customer" value="customer" onchange="" type="checkbox">
<label class="inline" >Customer</label>
</span>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="col-xs-12">
<div class="field col-xs-6">
<input class="submit" type="submit" value="<?php echo Mage::helper('contacts')->__('Send Enquiry') ?>" name="submit">
</div>
</div>
<div class="clear"></div>
</form>
<?php
//enquiry.php
$email=$_REQUEST['email'];
$phone=$_REQUEST['phone'];
$details=$_REQUEST['details'];
$interested=$_REQUEST['interested'];
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= "From: \"Request a Quote\" <fakhruddinsouq>\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message = '<html><head><title>Fakhruddin Souq</title></head><body>
<div style="color:#006A93; width:auto; height:auto; background-color:#eeeeee; margin:0px auto;">
<fieldset style=" border-color:#006A93; border-style:double;">
<legend align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:18px; text-decoration:underline;">Request a Quote</legend>
<head><title>Fakhruddin Souq</title></head>
<table border="0" cellpadding="0" cellspacing="4" align="left" width="100%" height="100%" style="color:#006A93; font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif;">
<td align="left" valign="top">Email: </td>
<td align="left" valign="top">'.$email.'</td>
</tr>
<tr>
<td align="left" valign="top">Phone: </td>
<td align="left" valign="top">'.$phone.'</td>
</tr>
<tr>
<td align="left" valign="top"> Product Details: </td>
<td align="left" valign="top">'.$details.'</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" style="font-size:14px;">Regards</td>
</tr>
</table>
<span style="clear:both; float:left; font-size:14px; padding-left:4px; padding-top:10px; font-family:Arial, Helvetica, sans-serif;">Posted Date & Time:'.date('m/d/Y H:i:s').'</span>
</fieldset>
</div>
</body>
</html>';
if($interested == 'logistics') {
$to = "abc#email.com";
}
else if($interested == 'sales') {
$to = "def#email.com";
}
else if($interested == 'customer') {
$to = "imemail#email.com";
}
else if($interested == 'logistics' && $interested == 'sales' && $interested == 'customer'){
$to = "abc#email.com,def#email.com,imemail#email.com";
}
else if($interested == 'logistics' && $interested == 'sales'){
$to = "abc#email.com,def#email.com";
}
else if($interested == 'logistics' && $interested == 'customer') {
$to = "abc#email.com,imemail#email.com";
}
else if($interested == 'sales' && $interested == 'customer') {
$to = "def#email.com,imemail#email.com";
}
else {
$to ="imemail#email.com";
}
if (mail($to,'Mail From '.$name,$message,$headers)){
print json_encode(array('type'=>'done', 'text' => 'Thank You For Your Enquiry'));
exit;
}
else {
print json_encode(array('type'=>'done', 'text' => 'Sorry Email is not sent'));
exit;
}
?>*
I have a problem with the Form I'm trying to create. Basically, it does not allow me to send the email to the recipient, even though the PHP code is correct. Few people from SO already tried to help, but it seems the code is not working.
<?php
$error = false;
$sent = false;
if(isset($_POST['submit'])) {
if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['comments'])) {
$error = true;
}
else {
$to = "linardsberzins#gmail.com";
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$comments = trim($_POST['comments']);
$subject = "Contact Form";
$message = "Name: $name \r\n Email: $email \r\n Comments: $comments";
$headers = "From:" . $name;
$mailsent = mail($to, $subject, $message, $headers);
if($mailsent) {
$sent = true;
}
}
}
?>
HTML:
<?php if($error == true){ ?>
<p class="error">Text</p>
<?php } if($sent == true) { ?>
<p class="sent">Text</p>
<?php } ?>
<div id="form">
<form name="contact" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset>
<h4>Contact Me!</h4>
<label for="name">Name:</label>
<input type="text" name="name" id="name"/>
<label for="email"/>Email:</label>
<input type="text" name="email" id="email"/>
<label for="comments" id="comments">Comments:</label>
<textarea name="comments" id=""></textarea>
<fieldset>
<input class="btn" type="submit" name="submit" class="submit" value="Send email"/>
<input class="btn" type="reset" value="Reset"/>
</fieldset>
</fieldset>
</form>
Do not rely on submit button as not all browsers send that button as a POST, change to other input:
if(isset($_POST['name'])) {
I have a form that sends its data to a process.php file for processing in that file I have the following code:
<?php
$name = $_GET['name'];
$number = $_GET['number'];
$email = $_GET['email'];
$comment = $_GET['message'];
$sales = $_POST['sales'];
$lettings = $_POST['lettings'];
$to = "me#me.com";
$subject = "New website registration";
$message = "Name: ".$name."\r\n";
if(isset($number) && $number!='')
$message.= "Number: ".$number."\r\n";
if(isset($email) && $email!='')
$message.= "Email: ".$email."\r\n";
if(isset($comment) && $comment!='')
$message.= "Comment: ".$comment."\r\n";
if(isset($sales))
{
$message.= "I am Interested in Sales" . "\r\n";
}else{
//
}
if(isset($lettings))
{
$message.= "I am Interested in Lettings";
}else{
//
}
$headers = "From: ".$name." <".$email.">";
$result = mail($to,$subject,$message,$headers);
return $result;
?>
The HTML for the form is as follows:
<form id="register_form" name="register" method="post" action="/content/contact/process.php">
<input type="text" id="name" name="name" class="regform" onFocus="if(this.value=='Name'){this.value='';}" onBlur="if(this.value==''){this.value='Name';}" value="Name" />
<input type="text" id="number" name="number" class="regform" onFocus="if(this.value=='Phone number'){this.value='';}" onBlur="if(this.value==''){this.value='Phone number';}" value="Phone number" />
<input type="text" id="email" name="email" class="regform" onFocus="if(this.value=='Email address'){this.value='';}" onBlur="if(this.value==''){this.value='Email address';}" value="Email address" />
<textarea id="message" name="message" class="regtext" onFocus="if(this.value=='Message'){this.value='';}" onBlur="if(this.value==''){this.value='Message';}">Message</textarea>
<label for"sales">Sales<input type="checkbox" name="sales" value="1" /></label>
<label for"sales">Lettings<input type="checkbox" name="lettings" value="1"/></label>
<input id="submit" type="submit" value="Submit" class="regsender" />
<div class="loading"></div>
</form>
When the checkboxes are checked, the expected messages do not come through in the email. Am I missing something here. I've tried several different approaches to getting this to work, none of which do. Any help would be appreciated. Thanks.
You are using method = POST and retrieving values with $_GET
I have updated your code check it
<?php
if(isset($_POST['submit'])){
$name = $_POST['name'];
$number = $_POST['number'];
$email = $_POST['email'];
$comment = $_POST['message'];
if (isset($_POST['sales']))
{
$sales = $_POST['sales'];
}
else if(isset($_POST['lettings']))
{
$lettings =$_POST['lettings'];
}
$to = "me#me.com";
$subject = "New website registration";
$message = "Name: ".$name."\r\n";
if(isset($number) && $number!='')
$message.= "Number: ".$number."\r\n";
if(isset($email) && $email!='')
$message.= "Email: ".$email."\r\n";
if(isset($comment) && $comment!='')
$message.= "Comment: ".$comment."\r\n";
if(isset($_POST['sales']))
{
$message.= "I am Interested in Sales" . "\r\n";
}
else if(isset($_POST['lettings']))
{
$message.= "I am Interested in Lettings";
}
echo $message;
$headers = "From: ".$name." <".$email.">";
$result = mail($to,$subject,$message,$headers);
return $result;
}
?>
<form id="register_form" name="register" method="post" action="testing_page.php">
<input type="text" id="name" name="name" class="regform" onFocus="if(this.value=='Name'){this.value='';}" onBlur="if(this.value==''){this.value='Name';}" value="Name" />
<input type="text" id="number" name="number" class="regform" onFocus="if(this.value=='Phone number'){this.value='';}" onBlur="if(this.value==''){this.value='Phone number';}" value="Phone number" />
<input type="text" id="email" name="email" class="regform" onFocus="if(this.value=='Email address'){this.value='';}" onBlur="if(this.value==''){this.value='Email address';}" value="Email address" />
<textarea id="message" name="message" class="regtext" onFocus="if(this.value=='Message'){this.value='';}" onBlur="if(this.value==''){this.value='Message';}">Message</textarea>
<label for"sales">Sales<input type="checkbox" name="sales" value="1" /></label>
<label for"sales">Lettings<input type="checkbox" name="lettings" value="1"/></label>
<input id="submit" name="submit" type="submit" value="Submit" class="regsender" />
<div class="loading"></div>
</form>