...

View Full Version : Contact Form



patrickdavis
08-19-2012, 02:18 PM
please can someone help me!!

i have this contact form but : www.suenomaintenance.com/contact.html

i need to get it working!!


<h2>Contact Form</h2>
<form action="" id="form">
<div class="container1">
<div class="col-3">
<div class="h"><input type="text" value="Name:" onblur="if(this.value=='') this.value='Name:'" onfocus="if(this.value =='Name:' ) this.value=''" /></div>
<div class="h"><input type="text" value="E-mail:" onblur="if(this.value=='') this.value='E-mail:'" onfocus="if(this.value =='E-mail:' ) this.value=''" /></div>
<div class="h"><input type="text" value="Telephone:" onblur="if(this.value=='') this.value='Telephone:'" onfocus="if(this.value =='Fax:' ) this.value=''" /></div>
</div>
<div class="col-4">
<textarea rows="40" cols="30" onblur="if(this.value=='') this.value='Message:'" onfocus="if(this.value =='Message:' ) this.value=''" >Message:</textarea>
<div class="container">
<div class="fright">
<a href="#" class="link-1" onclick="document.getElementById('form').reset()"><em><b>reset</b></em></a>
<div class="indent-2"><a href="#" class="link-1" onclick="document.getElementById('form').submit()"><em><b>submit</b></em></a></div>
</div>
</div>
</div>
<br class="clear" />
</div>
</form>

Jordann
08-19-2012, 02:21 PM
you havent got an action set for the form? have you got any php to it?

patrickdavis
08-19-2012, 03:21 PM
I'M just about to kill myself!!

cant get my bloody contact form to work!!

i keep getting a 405 verb used to access this page!
no email recieved or sent.. and page not redirected as expected?
help help help

php code:


<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_email = $_POST['cf_telephone'];
$field_message = $_POST['cf_message'];

$mail_to = 'Patrick@suenovillas.co.uk';
$subject = 'Message from a site visitor '.$field_name;

$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Telephone: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;

$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";

$mail_status = mail($mail_to, $subject, $body_message, $headers);

if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'http://www.suenomaintenance.com/contact.html/';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to patrick@suenovillas.co.uk');
window.location = 'http://www.suenomaintenance.com/contact.html/';
</script>
<?php
}
?>


html code


<h2>Contact Form</h2>
<form action="contact.php" method="POST" id="form">
<div class="container1">
<div class="col-3">
<div class="h"><input name="cf_name" type="text" value="Name:" onblur="if(this.value=='') this.value='Name:'" onfocus="if(this.value =='Name:' ) this.value=''" /></div>
<div class="h"><input name="cf_email" type="text" value="E-mail:" onblur="if(this.value=='') this.value='E-mail:'" onfocus="if(this.value =='E-mail:' ) this.value=''" /></div>
<div class="h"><input name="cf_telephone" type="text" value="Telephone:" onblur="if(this.value=='') this.value='Telephone:'" onfocus="if(this.value =='Telephone:' ) this.value=''" /></div>
</div>
<div class="col-4">
<textarea name="cf_message" rows="40" cols="30" onblur="if(this.value=='') this.value='Message:'" onfocus="if(this.value =='Message:' ) this.value=''" >Message:</textarea>
<div class="container">
<div class="fright">
<a href="#" class="link-1" onclick="document.getElementById('form').reset()"><em><b>reset</b></em></a>
<div class="indent-2"><a href="#" class="link-1" onclick="document.getElementById('form').submit()"><em><b>submit</b></em></a></div>
</div>
</div>
</div>
<br class="clear" />
</div>
</form>

patrickdavis
08-21-2012, 04:55 PM
does no one know how to resolve this issue?

AndrewGSW
08-21-2012, 05:12 PM
$field_email = $_POST['cf_email'];
$field_email = $_POST['cf_telephone'];

You're setting the email address to the telephone number.. mail() will probably still return true, but..

patrickdavis
08-21-2012, 06:05 PM
Right got the form to process... however i am now not recieveing any emails via the contact form

help

help

help

patrickdavis
08-21-2012, 06:43 PM
Way hay!! Got it all working correctly!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum