 |
Apache2Triad Help, Support and Development The apache2triad help , support and development forums
|
| View previous topic :: View next topic |
| Author |
Message |
QWERTYtech
Joined: 03 May 2006
Posts: 47
|
| Posted: Sat Jul 15, 2006 8:10 pm Post subject: contact.php form |
|
|
I have been working on a simple contact page and everything works until i try to submit a comment. Then my page displays an ERROR.
contact.php
Code:
<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>
<table width="400" border="0" align="center" 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>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" 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> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
send_contact.php
Code:
<?php
// Contact subject
$subject ="$subject";
// Details
$message="$detail";
// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";
// Enter your email address
$to ='someone@somewhere.com';
$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";
}
?>
http://redbeardcustoms.no-ip.info/WebSite/contact.php |
|
| Back to top |
|
cigraphics
Joined: 21 Aug 2005
Posts: 152
Location: Romania, Pitesti
|
| Posted: Mon Jul 31, 2006 10:00 am Post subject: |
|
|
try this one if you have problems please reply
Code:
<form action="send.php" method="post">
Name:<input type="text" name="name" value="Yourname" /><br>
Email:<input type="text" name="email" value="name@site.tld" /><br>
Subject:<input type="text" name="subject" value="Subject" /><br>
Message:<textarea style="width:200px;height:200px" name="message">Your message !</textarea><br>
<input type="submit" value="Send" /><input type="reset" />
</form>
send.php
Code:
<?php
if(!$name){
echo('<font color="red">Please type your name !</font>');
} elseif(!$email){
echo('<font color="red">Please type your email address !</font>');
} elseif(!$subject){
echo('<font color="red">Please type a subject !</font>');
} elseif(!$message){
echo('<font color="red">Please type a message !</font>');
} else {
$to = 'youremailaddress@site.tld';
$msg = 'Message from: '.$_POST['name'].' Message: '.$_POST['message'].'';
mail($to, $_POST['subject'], $msg, 'FROM: '.$_POST['email'].'');
echo('Thank you '.$_POST['name'].'');
}
?>
|
|
| Back to top |
|
invisible-root
Joined: 01 Jun 2007
Posts: 7
|
| Posted: Fri Jun 01, 2007 8:38 am Post subject: |
|
|
I made a contact form when I used to run http://pctech.4net.gr
Enjoy. |
|
| Back to top |
|
| |
|