Hey everyone,
I feel completely lost over here because I dont know what my tag is that i’m missing. This is a short and to the point contact page that has a small form on it for the user to submit something too. there’s some validation in it so if something isn’t filled out the mail wont send and will repopulate whatever they user entered correctly. any help would be great.
thank you!
Nick G
here’s the code for the whole site, only about 60 lines
[CODE]<?php
include(‘header.inc.php’);
if(isset($_POST[‘submit’])){
$to= “[email protected]”;
$from = $_POST[‘CustEmail’];
$subject = $_POST[‘MailSubject’];
$name = $_POST[‘CustName’];
$msg = $_POST[‘comments’];
if(!$from){
$error[0] = “*”;
$count = $count + 1;
}else{
$_SESSION[‘from’] = $from;
}
if(!$subject){
$error[1] = “*”;
$count = $count + 1;
}else{
$_SESSION[‘subject’] = $subject;
}
if(!$name){
$error[2] = “*”;
$count = $count + 1;
}else{
$_SESSION[‘name’] = $name;
}
if(!$msg){
$error[3] = “*”;
$count = $count + 1;
}else{
$_SESSION[‘msg’] = $msg;
}
if(!$count){
$msg .= $name;
$msg .= $from;
mail($to, $subject, $msg);
}
}
?>
<div id=”content”>
<?php
if($count > 1){
echo “Please Correct the Following Errors”;
}else{
echo “<p>Please take the time to send in any questions/comments you might have regarding AllOutdoorRecreation.com, and we will be sure to answer them quickly and adequately.<br/>”;
echo “Thank you from AllOutdoorRecreation.com staff.</p>”;
?>
<table>
<form method=”post” action=”contactus.php”>
<tr><td><?php echo “<font color=’red’>” . $error[3] . “</font>”; ?>Name:</td><td> <input type=”text” name=”CustName” size=”25″ value=”<?php echo $_SESSION[‘name’];?>”/></td></tr>
<tr><td><?php echo “<font color=’red’>” . $error[0] . “</font>”; ?>E-Mail: </td><td><input type=”text” name=”CustEmail” size=”25″ value=”<?php echo $_SESSION[‘from’];?>”/></td></tr>
<tr><td><?php echo “<font color=’red’>” . $error[1] . “</font>”; ?>Subject: </td><td><input type=”text” name=”MailSubject” size=”25″ value=”<?php echo $_SESSION[‘subject’];?>”/></td></tr>
<tr><td><?php echo “<font color=’red’>” . $error[2] . “</font>”; ?>Questions/Comments: </td><td><textarea name=”comments” cols=40 rows=6><?php echo $_SESSION[‘msg’]; ?></textarea></td></tr>
<tr><td colspan=”2″><input type=”submit” name=”contact” value=”Contact Us”/></td></tr>
</form>
</table>
<!–end content section–>
</div>
<?php include(‘footer.inc.php’);?>