PDA

View Full Version : PHP Code error



mike475
04-02-2008, 04:59 PM
Hey guys,

Im trying to make a php contact form, but theres something wrong with it and I cant figure out what. If someone could point me in the right direction?
Many thanks.

send_contact.php

<?php
// Contact subject
$subject ="Save Reg Petiton Entry";
// Details
$message="$detail";
// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";
// Enter your email address
$to ='[email protected]';
$send_contact=mail($to,$subject,$message,$header);
// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>

the form

<body>
<form action="contactsuccess.php" method="post">
<div class="row"><label class="col1">Name:&nbsp;&nbsp;</label>
<span class="col2"><input name="Name" class="input" type="text" id="Name" size="50" tabindex="1" /></span>
</div>
<div class="row"><label class="col1">E-mail:&nbsp;&nbsp;</label>
<span class="col2"><input name="Email" class="input" type="text" id="Email" size="50" tabindex="2" /></span>
</div>
<div class="row"><label class="col1comment">Comment:&nbsp;&nbsp;</label>
<span class="col2comment"><textarea cols="20" class="textarea" rows="4" name="comment" id="comment" tabindex="4" ></textarea></span>
</div>
<div align="center" class="submit"><input type="image" src="images/b_send.gif" alt="send" width="52" height="19" border="0" />
</div>
</form>
</body>


Thanks again;
Heres a link to the page thing :: http://www.savereg.co.uk/petition.php

Independent
04-02-2008, 06:16 PM
Hey guys,

Im trying to make a php contact form, but theres something wrong with it and I cant figure out what. If someone could point me in the right direction?
Many thanks.

send_contact.php

<?php
// Contact subject
$subject ="Save Reg Petiton Entry";
// Details
$message="$detail";
// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";
// Enter your email address
$to ='[email protected]';
$send_contact=mail($to,$subject,$message,$header);
// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>the form

<body>
<form action="contactsuccess.php" method="post">
<div class="row"><label class="col1">Name:&nbsp;&nbsp;</label>
<span class="col2"><input name="Name" class="input" type="text" id="Name" size="50" tabindex="1" /></span>
</div>
<div class="row"><label class="col1">E-mail:&nbsp;&nbsp;</label>
<span class="col2"><input name="Email" class="input" type="text" id="Email" size="50" tabindex="2" /></span>
</div>
<div class="row"><label class="col1comment">Comment:&nbsp;&nbsp;</label>
<span class="col2comment"><textarea cols="20" class="textarea" rows="4" name="comment" id="comment" tabindex="4" ></textarea></span>
</div>
<div align="center" class="submit"><input type="image" src="images/b_send.gif" alt="send" width="52" height="19" border="0" />
</div>
</form>
</body>
Thanks again;
Heres a link to the page thing :: http://www.savereg.co.uk/petition.php

LOL! at what your sites about,
I can't really help, I suck at forms. I'll ask my bro'

MrCraig
04-02-2008, 09:14 PM
youve set form action to contactsuccess.php instead of send_contact.php

Caleb
04-02-2008, 09:18 PM
Register globals?! Ew. Define and clean your $_POST[]'s not RG.
I will look at it later.

You also do not need to enclose your variables with ""'s,

$bla = $bla is just fine.

No need to put $bla = "$bla"; =\

Invent
04-02-2008, 09:22 PM
Definately clean your $_POST's in terms of \n and \r. I could fake a few emails using that ^_^

Want to hide these adverts? Register an account for free!