Jump to content

contact form doesnt work. urgent...


soulroll

Recommended Posts

Hi guys, i have a website template and managed to changed it, but now i have problems with my contact form. i dont know how to make it work. have a look on the site please http://www.bracksconsulting.com/index-5.html

 

and this is my css code for the contact form.

what php code do i have to write for this css contact form?? could someone please help me!!!

i googled a lot and tried to customize them, but everytime it didnt work or it showed me straight the php code.....

 

This is my html code of the contact section:

 

<div class="col_2">

<div class="indent">

<img src="images/t6_3.gif" alt="" class="title" /><br />

<form action="" enctype="multipart/form-data" id="form">

<div class="box">

<div class="col_box_1">

Your name:

<div class="div_input"><input name="name" type="text" id="name" />

</div>

E-mail address:

<div class="div_input"><input name="email" type="text" id="email" />

</div>

Phone:

<div class="div_input"><input name="phone" type="text" id="phone" />

</div>

</div>

<div class="col_box_2">

Your message:

<div><textarea name="message" cols="0" rows="0" id="message"></textarea>

</div>

</div>

<div class="clear"></div>

</div>

<div class="div_links"><a class="link_3" href="#" onclick="document.getElementById('form').reset()"> clear</a><img src="images/spacer.gif" alt="" height="1" width="15" /><a class="link_3" href="#" onclick="document.getElementById('form').submit()" >submit</a></div></form>

</div>

</div>

<div class="clear"></div>

</div>

</div>

 

 

 

Thank youv

Link to comment
Share on other sites

start with the basics...get it working then add your css

 

 

ok do this...

 

use this 1st

 


<form method="POST" action="mailer.php">
   <input type="text" name="name" size="19"><br>
   <br>
   <input type="text" name="email" size="19"><br>
   <br>
  <input type="text" name="phone" size="19"><br>
   <br>
   <textarea rows="9" name="message" cols="30"></textarea>
   <br>
   <br>
   <input type="submit" value="Submit" name="submit">
</form>

 

creat mailer.php and add this

 

<?php
if(isset($_POST['submit'])) {

$to = "you@you.com"; // type your email add in here
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$phone_field = $_POST['phone'];
$message = $_POST['message'];

$body = "From: $name_field\n E-Mail: $email_field\n PHONE: $phone_field\n Message:\n $message";

echo "Data has been submitted to $to!";
mail($to, $subject, $body);

} else {

echo "error in sending email!";

}
?>

 

 

then try it... then add your css around it

Link to comment
Share on other sites

To follow up on runnerjp's post:

 

Replace

<form action="" enctype="multipart/form-data" id="form">

 

with

 

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

 

but otherwise you can leave your code alone.

 

Upload his mailer.php script and keep your fingers crossed ...

Link to comment
Share on other sites

THANK YOU GUYS FOR YOUR HELP!

..but still doesnt work  :(

 

first i tried the first idea... so i pasted the html code in and created a mailer.php and uploaded it. when i try to send the message, a respond comes that the message was send to my adress, but nothing comes...

 

here is a copy of the html code...hope it was in the right spot. (i copied a bit more for you guys here, just too see better where i copied it in)

 

<div class="col_2">

<div class="indent">

<img src="images/t6_3.gif" alt="" class="title" /><br />

              <form method="POST" action="mailer.php">

  <input type="text" name="name" size="19"><br>

  <br>

  <input type="text" name="email" size="19"><br>

  <br>

  <input type="text" name="phone" size="19"><br>

  <br>

  <textarea rows="9" name="message" cols="30"></textarea>

  <br>

  <br>

  <input type="submit" value="Submit" name="submit">[/color]

</form>

  </div>

</div>

<div class="clear"></div>

</div>

</div>

 

 

 

then i tried the other version and changed the new code in my old one in...but now comes "error in sending email!"

 

so...i go crazy...what could i do now???

Link to comment
Share on other sites

THANK YOU GUYS FOR YOUR HELP!

..but still doesnt work  :(

 

first i tried the first idea... so i pasted the html code in and created a mailer.php and uploaded it. when i try to send the message, a respond comes that the message was send to my adress, but nothing comes...

 

Did you get a blank message, or just no message at all? Sometimes php mail() messages get eaten by spam filters, so maybe double check that hasn't happened to you.

Link to comment
Share on other sites

a friend of mine just send me per mail this code. he said its not finished, but should have a look on it. should suit to my first html code(posted above)  my problem is i dont understand whats not finished and where should i edit my email adress...

<?php

if ($_POST) {
    // set variables
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $message = $_POST['message'];

    // now you would email using the mail() function.
    // I've written most of the script for you, so now it's your turn to figure this out
    // If you have specific questions, ask them.

} else {
    echo '<div class="col_2">
<div class="indent">
<img src="images/t6_3.gif" alt="" class="title" /><br />
<form action="contact.php" method="post" enctype="multipart/form-data" id="form">
<div class="box">
<div class="col_box_1">
Your name:
<div class="div_input"><input name="name" type="text" id="name" />
</div>
E-mail address:
<div class="div_input"><input name="email" type="text" id="email" />
</div>
Phone:
<div class="div_input"><input name="phone" type="text" id="phone" />
</div>
</div>
<div class="col_box_2">
Your message:
<div><textarea name="message" cols="0" rows="0" id="message"></textarea>
</div>
</div>
<div class="clear"></div>
</div>
<div class="div_links"><a class="link_3" href="#" onclick="document.getElementById(\'form\').reset()"> clear</a><img src="images/spacer.gif" alt="" height="1" width="15" /><a class="link_3" href="#" onclick="document.getElementById(\'form\').submit()" >submit</a></div></form>
</div>
</div>
<div class="clear"></div>
</div>
</div>';
}

?>

 

 

Link to comment
Share on other sites

a friend of mine just send me per mail this code. he said its not finished, but should have a look on it. should suit to my first html code(posted above)  my problem is i dont understand whats not finished and where should i edit my email adress...

 

Follow runnerj's instructions for the second code block he gave you in his first reply - where your friend has put "contact.php" as the form action, runnerj has used "mailer.php". Should work for you :)

Link to comment
Share on other sites

I am going to have to suggest a PHP Mailer class that I have been using for some time now. It's VERY fast and has yet to let me down.

 

http://phpmailer.codeworxtech.com/

 

This is a VERY extensive class and has lost of room to add if you are in to that but the basic idea will get you started and emailing in PHP fast and easy.

 

Here is a basic example of how to send an HTML email.

 

<?php

require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->ClearAddresses();
$mail->AddAddress($_POST['email']);
$mail->FromName = "My Name";
$mail->FromAddress = "me@mail.com";

$mail->IsHTML(true);
$mail->WordWarp

$mail->Subject = "Thank you!";

$body  = "<div><h4>My Title!</h4></div>";
$body .= "Thank you Info what not here blah blah<br><br>";
$body .= "<p>Your Var = ".$myVar."</p>";

$this->Body = $body;

if($mail->Send() !== false)
{
    echo "YAY WE DID IT!";
}
else
{
   echo "Jump!";
}

?>

 

I hope this helps you!

Link to comment
Share on other sites

OK guys. i show you exaxctly what my code is. please check if everything is fine(should be) i just spoke with my hosting company and they told me they support php mails.

 

the html code of the site is this:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="layout.css" rel="stylesheet" type="text/css" />
<script src="rollover.js" type="text/javascript"></script>

</head>
<body id="page6" onload="MM_preloadImages('images/m1_1.jpg','images/m2_1.jpg','images/m3_1.jpg','images/m4_1.jpg','images/m5_1.jpg','images/m6_1.jpg')">
<div id="site_center">
<div id="main">
<!-- header  -->
<div id="header">
	<div class="col_1"><h1>consulting.co providing solutions you can trust</h1></div>
	<div class="col_2">
	  <div class="clear"></div></div>
	<div class="clear"></div>

</div>
<div id="menu">
  <a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','images/m1_1.jpg',1)"><img class="m1" src="images/m1.jpg" alt=" " width="124" height="63" id="Image1" /></a><a href="index-1.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/m2_1.jpg',1)"><img src="images/m2.jpg" alt=" " width="124" height="63" id="Image2" /></a><a href="index-2.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/m3_1.jpg',1)"><img src="images/m3.jpg" alt=" " width="125" height="63" id="Image3" /></a><a href="index-3.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','images/m4_1.jpg',1)"><img src="images/m4.jpg" alt=" " width="124" height="63" id="Image4" /></a><a href="index-4.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','images/m5_1.jpg',1)"><img src="images/m5.jpg" alt=" " width="124" height="63" id="Image5" /></a><a href="index-5.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','images/m6_1.jpg',1)"><img src="images/m6_1.jpg" alt=" " width="125" height="63" id="Image6" /></a> </div>
  <div id="wrapper_header">
  	<div class="indent">
  	  <p> </p>
  	  <p> </p>
  	  <p> </p>
  	  <p> </p>
  	  <p><br /> 
  	        <a href="#"><img src="images/wrapper_header_button.jpg" alt="" class="button" /></a><br />
  	        </p>
  	</div>
    </div>
<!-- content -->
<div id="content">
	<div class="indent_1"></div>
  <div class="width">
		<div class="col_1">
		  <div class="indent">
			<img src="images/t6_2.gif" alt="" class="title" /><br />
			<img src="images/contact.png" alt="" class="pic" />
			<p><strong> Amanda Bracks-Taylor<br />
		    PO Box 184<br />
Stanhope Gardens, NSW 2728</strong></p>

			Mobile: 0419435908<br />
E-mail: <a href="mailto:abracks@bigpond.com">abracks@bigpond.com</a> </div>
		</div>
		<div class="col_2">
			<div class="indent">
			<img src="images/t6_3.gif" alt="" class="title" /><br />
                <form method="POST" action="mailer.php">
                  <p>Your Name:
                    <input type="text" name="name" size="19">
                    <br>
                    <br>
   Your email:
    <input type="text" name="email" size="19">
   <br>
   <br>
  Your phone: 
  <input type="text" name="phone" size="19">
  <br>
  </p>
                  <p>
                    Your message:
                     <textarea rows="9" name="message" cols="30"></textarea>
                     <br>
                    <br>
                    <input type="submit" value="Submit" name="submit">
                                    </p>
                </form>
		  </div>
		</div>
		<div class="clear"></div>
	</div>
</div>
<!-- footer -->
<div id="footer">
	<div class="indent">Bracks Consulting © 2008 • <a href="http://www.leisureone.com.au"><img src="images/rocket.png" alt="leisure one" width="71" height="22" class="ind" /></a><a href="index-6.html"></a></div>
</div>
</div>	
</div>
</body>
</html>

 

my php code: (mailer.php)

<?php
if(isset($_POST['submit'])) {

$to = "roland.karoliny@gmail.com"; // type your email add in here
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$phone_field = $_POST['phone'];
$message = $_POST['message'];

$body = "From: $name_field\n E-Mail: $email_field\n PHONE: $phone_field\n Message:\n $message";

echo "Data has been submitted to $to!";
mail($to, $subject, $body);

} else {

echo "error in sending email!";

}
?>

 

Link to comment
Share on other sites

ok...now, the code seems to work fine. but not on this site!!!!! dont really know why!!!!!

i uploaded it on an other site just to test it. and its the same hosting company and it works. i copied the entire code...no css but.

 

have a look www.roland-karoliny.com/form but doesnt work here http://www.bracksconsulting.com/index-5.html

 

so whats up now???/

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.