Jump to content

Recommended Posts

I can get it to work but it looks ugly. If I get it to look pretty it doesn't work. Please help me fix it and make it stay the same. 

 

Html Code:

          <h3>Contact Form</h3>
          <form id="ContactForm" action="contact.php" method="post">
            <div>
              <div class="wrapper"> <span>Your Name:</span>
                <input type="text" class="input" name="cf_name" >
              </div>
              <div class="wrapper"> <span>Your E-mail:</span>
                <input type="text" class="input" name="cf_email">
              </div>
              <div class="textarea_box"> <span>Your Message:</span>
                <textarea name="cf_message" cols="1" rows="1"></textarea>
              </div>
              <a href="#" class="button1">Send</a> <a href="#" class="button1">Clear</a> </div>
          </form>

Then The Php:

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

$mail_to = 'contact@zappyhosting.com';
$subject = 'Message from a site visitor '.$field_name;

$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$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 = 'contact_page.html';
	</script>
<?php
}
else { ?>
	<script language="javascript" type="text/javascript">
		alert('Message failed. Please, send an email to gordon@template-help.com');
		window.location = 'contact_page.html';
	</script>
<?php
}
?>
Link to comment
https://forums.phpfreaks.com/topic/287903-contact-form-help/
Share on other sites

I don't like this:

<a href="#" class="button1">Send</a> <a href="#" class="button1">Clear</a>

 

There is nothing to differentiate the two links. I would expect some javascript to actually submit the form, looking at these <a> tags for a click event.

Link to comment
https://forums.phpfreaks.com/topic/287903-contact-form-help/#findComment-1476810
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.