The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> contact form, HELP
stingerlives
post May 20 2018, 10:08 AM
Post #1





Group: Members
Posts: 5
Joined: 20-May 18
Member No.: 26,647



contact form isn't working and for the life of me i can't figure out why. any help is greatly appreciated.

<form action="contact.php">
<div class="form">
<div class="form-text">

<input id="cf_name" type="text" class="textbox" value="Your Name*" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Name';}">
<input id="cf_email" type="text" class="textbox" value="Your E-mail*" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'E-mail';}">
<input id="cf_eventinfo" name="Event Info" type="text" class="Subject" value="Event Info" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Event Info';}">
</div>
<textarea id="cf_message" placeholder="Your Message*"></textarea>
<div class="clear"> </div>
<input type="submit" value="SEND MESSAGE">

</div>
</form>

here is my php....

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

$mail_to = '***@trippswebb.com';
$subject = 'Message from a site visitor '.$field_name;

$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Event Info: '.$field_eventinfo."\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 = 'contactlanding.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to ***@trippswebb.com');
window.location = 'contactlanding.html';
</script>
<?php
}
?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th April 2024 - 05:18 PM