Jump to content


My contact form doesn't work


7 replies to this topic

#1 Matheus

    P2L Jedi Master

  • Members
  • PipPipPipPip
  • 1,058 posts
  • Gender:Not Telling

Posted 20 June 2006 - 07:30 PM

Everything seems to work fine, but Doesnt send me the e-mail.
I followed this tutorial that I fond on pixel2life: http://www.phpeasyst...opview.php?id=8

my contact page that doesn't send anything

my code:
contact.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>


<div align="left">
  <table width="400" border="0" cellpadding="3" cellspacing="1">
	<tr>
	  <td><div align="left"><strong>Contact Studio Stortz  </strong></div></td>
	</tr>
  </table>
  <table width="400" border="0"cellpadding="0" cellspacing="1">
	<tr>
	  <td><form name="form1" method="post" action="send_contact.php">
		  <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<tr>
			  <td width="16%">Subject</td>
		<td width="2%">:</td>
		<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
		</tr>
			<tr>
			  <td>Message</td>
		<td>:</td>
		<td><textarea name="detail" cols="50" rows="8" id="detail"></textarea></td>
		</tr>
			<tr>
			  <td>Name</td>
		<td>:</td>
		<td><input name="name" type="text" id="name" size="50"></td>
		</tr>
			<tr>
			  <td>Email</td>
		<td>:</td>
		<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
		</tr>
			<tr>
			  <td>&nbsp;</td>
		<td>&nbsp;</td>
		<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
		</tr>
		  </table>
	  </form>	</td>
	</tr>
  </table>
</div>
</body>
</html>

send_contact.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body><?php
$subject ="$subject";
$message="$message";


$mail_from="$customer_mail";

$header="from: $name <$mail_from>";


$to ='aukanoob@gmail.com';

$send_contact=mail($to,$subject,$message,$header);


if($send_contact){
echo "Your message was sucessful submited";
}
else {
echo "Error, something is wrong at your form.";
}
?>
</body>
</html>

thankyou for your time

#2 Donna

    Retired P2L Queen!

  • P2L Staff
  • PipPipPipPip
  • 12,330 posts
  • Gender:Female
  • Location:B.C Canada

Posted 20 June 2006 - 07:39 PM

If this is any help http://www.tele-pro....s/contact_form/ try that as that works 100%

#3 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 20 June 2006 - 08:39 PM

here's a rework for ya. it's not exactly what i would've done, but i tried to keep it like you had it. :P


send_contact.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Send Mail</title>
</head>
<body><?
$subject = htmlspecialchars($_POST['subject']);
$message = htmlspecialchars($_POST['message']);
$mail_from = "From: ".$_POST['name']. "<".$_POST['customer_mail'].">";
$to ='your_email@gmail.com';
$headers = "MIME-Version: 1.0\r\n".
	"Content-type: text/html; charset=iso-8859-1\r\n".$mail_from.
	"Date: ".date("r")."\r\n".
	"Subject: ".$subject."\r\n";
$send_contact = mail($to,$subject,$message,$headers);
if($send_contact){ echo "Your message was sucessful submited"; }
else { echo "Error, something is wrong at your form."; }
?></body>
</html>

contact.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Contact Me</title>
<style type="text/css">
<!--
body, html { background: #EFEFEF; color: #4578AB; }
body, html, input, textarea {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
}
h3 {
	margin: 0px;
	font-weight: normal;
	font-size: 18px;
	color: #4578AB;
	text-transform: lowercase;
	letter-spacing: 1px;
}
-->
</style>
</head>
<body>
<div align="left">
<form method="post" action="send_contact.php">
<table border="0" cellspacing="1" cellpadding="3">
	<tr><td colspan="3"><h3>Contact Studio Stortz</h3></td></tr>
	<tr><td align="right">Subject</td><td>&nbsp;</td><td><input name="subject" type="text" size="50" /></td></tr>
	<tr><td align="right">Message</td><td>&nbsp;</td><td><textarea name="message" cols="50" rows="8"></textarea></td></tr>
	<tr><td align="right">Name</td><td>&nbsp;</td><td><input name="name" type="text" size="50" /></td></tr>
	<tr><td align="right">Email</td><td>&nbsp;</td><td><input name="customer_mail" type="text" size="50" /></td></tr>
	<tr><td>&nbsp;</td><td>&nbsp;</td><td><input type="submit" name="Submit" value="Submit" /><input type="reset" name="Submit2" value="Reset" /></td></tr>
</table>
</form>
</div>
</body>
</html>

since there's no actual PHP in the contact form, it doesn't necessarily have to have the PHP extension.

you can test at http://testing.spati...om/contact.html. unfortunately you won't see the email received.



edit:

Now that's convenient. :P

check out the front page at the Top 20 Tutorials. :)

http://www.pixel2life.com/count_tutorial/3...a_contact_form/

http://www.pixel2life.com/

Edited by SpatialVisionary, 21 June 2006 - 02:37 PM.


#4 Matheus

    P2L Jedi Master

  • Members
  • PipPipPipPip
  • 1,058 posts
  • Gender:Not Telling

Posted 22 June 2006 - 09:09 PM

It doesn't work with BOTH codes
the tele pro and visionary's one

I put the code of the inputs
I save a php with the php codes (functions of the forms that stuff)
upload to mu host (that suports php perfeclty) everything is just FINE, my tester friend do everything correct and got the right messege of "sucessful submited" BUUUUUUUUUUUUT, I get NO mail.

what's wrong? can someone explain why I don't get the e-mail????

thanks

edit: you can take a look at it online at http://studiostortz....om/contact.html
look the source code, is everything in place... i don't understand why is not working :whistle:

Edited by Myoto, 22 June 2006 - 09:11 PM.


#5 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 22 June 2006 - 10:34 PM

$to ='your_email@gmail.com';

well, as long as your put the email address you want it sent to there and you're still using the gmail account like in first post, I would begin to question whether you have access to send mail using the PHP mailer.

is that your domain, or your sub domain?

#6 Matthew.

    Official Spammer .Matt

  • Members
  • PipPipPipPip
  • 2,749 posts
  • Gender:Male
  • Location:England

Posted 23 June 2006 - 10:46 AM

Lets think outside the box shall we? :D

Myoto, run this:
<?php
mail('youremail@domain.tld', 'email test', 'Test');
?>

If you don't receive it, its likely PHP safe mode is enabled on your server.

I reckon this can be checked by using phpinfo() ;)

#7 Matheus

    P2L Jedi Master

  • Members
  • PipPipPipPip
  • 1,058 posts
  • Gender:Not Telling

Posted 23 June 2006 - 08:28 PM

the e-mail must be from my domain? like: studiostortz@awardspace.com?

or can be anything else?

#8 coolaid

    P2L Jedi Master

  • Members
  • PipPipPipPip
  • 1,435 posts
  • Gender:Male
  • Interests:i wonder..

Posted 23 June 2006 - 09:31 PM

the email in the fist parenthesis mail("***", "", "") can be any email address, its the address that the email will be sent to.

Edited by coolaid, 23 June 2006 - 09:31 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users