DJ Hands3
03-08-2009, 02:11 PM
I a have php web form and have managed to get the users values displayed on the next page so they can see what they have sent but when the user for example dosent fill everything in it displays an error of whatever they havent done i cant get it to format in the same way as if the form was done correctly, I know its something to do with the script outputing it directly rather than reading from the page so the css dosent kick in?
any ideas?
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h1>Contact dj-promo.co.uk</h1>
<div class="box">
<h2 class="box">
Form error
</h2>
<div class="wysiwyg">Please enter a valid email address
</div>
<div class="filebox_links">
<a href="contact.php">Click here to go back</a>
</div>";
$badinput = "<h2>Feedback was NOT submitted</h2>";
echo $badinput;
die (" ");
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h1>Contact dj-promo.co.uk</h1>
<div class="box">
<h2 class="box">
Form error
</h2>
<div class="wysiwyg">Please fill out all fields
</div>
<div class="filebox_links">
<a href="contact.php">Click here to go back</a>
</div>";
die (" ");
}
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";
mail("mysite@mysite.co.uk", $subject, $message, $from);
?>
<h1>Contact dj-promo.co.uk</h1>
<div class="box">
<h2 class="box">
Use the form below to get in touch
</h2>
<div class="wysiwyg"><Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />
Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>
</div>
<div class="filebox_links">
<br /><br />
<a href="contact.php"> Next Page </a>
</div>
any ideas?
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h1>Contact dj-promo.co.uk</h1>
<div class="box">
<h2 class="box">
Form error
</h2>
<div class="wysiwyg">Please enter a valid email address
</div>
<div class="filebox_links">
<a href="contact.php">Click here to go back</a>
</div>";
$badinput = "<h2>Feedback was NOT submitted</h2>";
echo $badinput;
die (" ");
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h1>Contact dj-promo.co.uk</h1>
<div class="box">
<h2 class="box">
Form error
</h2>
<div class="wysiwyg">Please fill out all fields
</div>
<div class="filebox_links">
<a href="contact.php">Click here to go back</a>
</div>";
die (" ");
}
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";
mail("mysite@mysite.co.uk", $subject, $message, $from);
?>
<h1>Contact dj-promo.co.uk</h1>
<div class="box">
<h2 class="box">
Use the form below to get in touch
</h2>
<div class="wysiwyg"><Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />
Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>
</div>
<div class="filebox_links">
<br /><br />
<a href="contact.php"> Next Page </a>
</div>