PDA

View Full Version : Form Mailer Problem!



rainarts
07-31-2008, 01:19 PM
Hi to the php expert's! Im always getting error message on my server with this email form. Hope some1 can fix this. Tnx...

The script is as follow:


feedback.php




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Mailer</title>
</head>
<body>
<h2>Feedback Form</h2>
<form method="post" action="sendemail.php">


<?php
$ipi = getenv("REMOTE__ADDR");
$httpref = getenv("HTTP__REFERER");
$httpagenti = getenv("HTTP__USER__AGENT");
?>


<input type="hidden" name="ip" value="
<?php echo $ ipi ?>
" />

<input type="hidden" name="httprefi" value="
<?php echo $ httprefi ?>
" />

<input type="hidden" name="httpagent" value="
<?php echo $ httpagenti ?>
" />

Name :<br />
<input type="text" name="visitor" size="23" /><br />

E-mail :<br />
<input type="text" name="visitormail" size="23 /><br />
<br />&nbsp;<br />
Concern :<br />
<select name="attn" size="1">
<option value=" Tutorial">Tutorial</option>
<option value=" Technical Support">Technical Support</option>
<option value=" Html Issue">HTML Issue</option>
<option value=" WebMaster">WebMaster</option></select>
<br />&nbsp;<br />
Your Comments' :<br />
<textarea name="notes" rows="5" cols="40"></textarea><br />
<input type="submit" value=" Send Mail " style="position: relative; left: 140px; bottom: 4px" />
<br />
</form>
<p>&nbsp;</p>
</div>
</body>
</html>



sendemail.php



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sending Email</title>
</head>
<body>


<?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_['attn'];

if (eregi('http', $notes))
{
die ("Please Try Again!");
}
if (!$visitormail == "" && (!strstr($visitormail, "@") || !strstr($visitormail, ".")))
{ echo "<h2>Please Enter a Valid e-mail address</h2>\n";
$badinput = "<h2>FeedBack was not submitted!</h2>\n";
echo $badinput;
die ("Going Back! ");
}
if (empty($vistor) || empty($visitormail) || empty($notes))
{ echo "<h2>Required field\'s is left empty! </h2>\n";
die ("Please Try Again!"); }
$todayis = date("I, F j, Y, g:i a");
$attn = $attn;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n Concern: $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("info@rainarts.net46.net", $subject, $message, $from);
?>
<p align="center">
<?php echo $todayis ?>

<br />
Thank You :
<?php echo $visitor ?> ( <?php echo $ visitormail ?> )

<br />
Concern:
<?php echo $attn ?>

<br />
Message:<br />

<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>

<br />

<?php echo $ip ?>

<br /><br />
<a href="feedback.php"> H O M E </a>
</p>
</body>
</html>


That does it for all the codes'! I wonder which part of this code is generating those error! Waiting for kind reply... Tnx

allahverdi
07-31-2008, 02:18 PM
can you write error below?

rainarts
07-31-2008, 04:19 PM
Tnx
The Error goes like this.


Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /home/public_html/feedback.php on line 139.

allahverdi
07-31-2008, 05:06 PM
I'm not sure. But in some variables there are space between $ and variable name. I can't say correctly now. Will look at it again once more. I'm not at comp ><

DimX
07-31-2008, 05:10 PM
The error message pretty much tells you what's the problem.
For some reason you have a space between the $ character and the actual name of the variable in some places (in both files!):

<?php echo $ ipi ?>

<?php echo $ httprefi ?>

<?php echo $ httpagenti ?>

<?php echo $ visitormail ?>

------------
Whoops, allahverdi was faster :P

allahverdi
07-31-2008, 05:15 PM
DimX,
Thanks for quotes.

P.S. I found error too...

rainarts
08-01-2008, 03:44 AM
I didnt figure that 1 one out! Big tnx to you guyz...