Jump to content

CONTACT FORM


khujo56

Recommended Posts

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

something different.......Here is a simple php contact form code that I am using on my website right now. Our website has the exact same form as yours on your website. (2 textfields and 1 text area) Just make sure you name your fields on the contact form the same as the fields in the body section of the php code.  This will email blank spaces as well as text.

<?php
$to = "webmaster@iheartvacation.com";
$subject = "Contact form";
$body = "
\n\n Name: $Name
\n\n E-Mail Address: $Email
\n\n Comments: $Comments";

mail ($to, $subject, $body);
header("Location: http://www.iheartvacation.com/");
?> 

Link to comment
Share on other sites

  • 2 weeks later...

ok here is the html for the form

 

<form action="mailer.php" method="post" name="Form1" id="Form1" >

<div class="m" style="margin-left:8px; margin-bottom:4px ">Name</div>

<input name="name" type="text" id="name" style="width:290px; height:19px; font-family:Tahoma, Arial, Helvetica, sans-serif; font-size:10px; color:#848484 " onFocus="this.value=''" onClick="this.value=''" value="">

<img src="images/spacer.gif" height="4" style="display:block ">

<div class="m" style="margin-left:8px; margin-bottom:4px ">E-mail</div>

 

<input name="email" type="text" id="email" style="width:290px; height:19px; font-family:Tahoma, Arial, Helvetica, sans-serif; font-size:10px; color:#848484 " onFocus="this.value=''" onClick="this.value=''" value="">

<img src="images/spacer.gif" height="4" style="display:block ">

<div class="m" style="margin-left:8px; margin-bottom:4px ">Message</div>

 

<textarea name="message" id="message" style="width:445px; height:80px; overflow:hidden; font-family:Tahoma, Arial, Helvetica, sans-serif; font-size:10px; color:#848484 " onFocus="this.value=''"  onClick="this.value=''"></textarea>

<div style="padding-top:8px; margin-right:30px; margin-top:15px " align="right" class="red "><img src="images/kv.jpg" align="absmiddle" style="margin-right:5px ">

<a href="#" class="red2 " onclick="javascript:document.Form1.reset();">Reset</a>       <img src="images/kv.jpg" align="absmiddle" style="margin-right:5px ">

<input type="submit" name="submit" value="Submit">

</div>

</form

 

here is the code for the php:

 

<?php

if(isset($_POST['name']) && empty($_POST['name']))

{

    $error[] = "Post your name";

}

if(isset($_POST['email']) && empty($_POST['email']))

{

    $error[] = "Post your e-mail address";

}

if(isset($_POST['message']) && empty($_POST['message']))

{

    $error[] = "Post your comments";

}

if(is_array($error))

{

    echo("errors:

");

    foreach($error as $x => $i)

    {

        echo("- ".$i."

");

    }

}

else

{

    $to = "webmaster@iheartvacation.com";

    $subject = "subject";

    $message = $_POST['message'];

    $name = $_POST['name'];

    $from = $_POST['email'];

    mail($to, $subject, $message, "From: $name<$from>");

    echo("<script>alert(\"Thanks!\E-mail has been sent!\");</script>");

   

}

?>

 

thanks

Link to comment
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.