View Full Version : Another php form problem!! Contact form not delivering to specified email address....

11-09-2010, 06:47 PM
Hi guys, new member, nice to meet u all!!! please can someone help me?!?!

id love Someone to look through my code, as i cannot for the life of me work out how to make this form deliver an email to an address!!!!

the unfinished site is here: http://www.qubicsolutions.co.cc

I have trawled through the forum, trying to find a solution to this problem (many reported) and cant find one to work for me...

each are content specific, i have a contact form on a site i am in the process of building.

Everything seems to work, but the email never arrives at the specified email address after the form...

Ive tried everything!!!!!!!!!

im not sure if its to do with 000webhost, or my domain or simply wrong coding

If someone could help me before i lob my macbook out the window,

thanks guys, much appreciated!!!!!


$emailSubject = 'qubiccontactform!';
$webMaster = 'twistedbreakz@yahoo.co.uk';

$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$comments = $_POST['comments'];

$body = <<<EOD
Name: $name <br>
Email: $email <br>
Subject: $subject <br>
Comments: $comments <br>
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body,

$theResults = <<<EOD
<title>sent message</title>
<meta http-equiv="refresh" content="3;URL=http://www.qubicsolutions.co.cc">
<style type="text/css">
body {
background-color: #999;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #fec001;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
<div align="center">Thank you for your enquiry to Qubic Web Solutions, we will respond to your question as soon as possible</div>
echo "$theResults";


<form name="form1" method="post" action="qubiccontactform.php">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="name" id="name">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="email" id="email">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="subject" id="subject">

<label><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Comments & Questions:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<textarea name="comments" id="comments" cols="45" rows="3"></textarea>


<form name="form1" method="post" action="qubiccontactform.php">
<input type="image" src="images/images/send_it.jpg" width="101" height="31" name="submit" id="submit" value="Submit">

The submit button is a custom button seperate to the form instance, im not sure if this is where my problem lies, but i have inserted a submit button into the form to test and no email is sent still!!

If someone could take a look at this i would be propa chuffed, as its doin my head in!!!

11-09-2010, 07:31 PM
check your headers, try

$headers = "From: $email"."\r\n";
$headers .= "Content-type: text/html; charset=UTF-8"."\r\n";

11-09-2010, 08:04 PM
will try it now,

thanks for the quick reply!!

i will let you know the results :thumbsup:

11-09-2010, 08:15 PM

i recieved the mail,

just with no content!!!! ;)

any ideas!?

11-09-2010, 08:36 PM
check your encoding in the header and try to replace the $body variable in the mail function with some string, 'test' for example

11-09-2010, 08:38 PM
If you echo $body, does it look right?

11-09-2010, 08:41 PM
Thanks guys, you have no idea how much i appreciate this

EOT didnt work....

will try echo $body, without sounding think, how exactly can i tie this in??

11-09-2010, 08:44 PM
i see, to use as a test... makes sense!!! and no still no content, just headings!!!

11-09-2010, 08:53 PM

i can see the problem now with the content.

its to do with the seperate submit button.

i have inserted a standard submit button within the form and it has worked...

any ideas now?!?! i dont want to use the horrible standard submit buttons. if you take the link to the site you will see what i mean...

11-09-2010, 08:59 PM
something wrong with your heredoc syntax, I've copypasted it and have had to rewrite ";" symbol
also you can check for a right new lines

11-09-2010, 09:08 PM
all sorted, it was to do with my form tags...

thanks for your help with the headers, it is now sending me mail, albeit into my junk folder but sending with content nonetheless!!!

cheers guys.

11-09-2010, 09:08 PM
an image submit button:

<button name="submit" id="submit">
<img src="images/images/send_it.jpg" width="101" height="31" alt="submit">