|
-
Mar 30th, 2004, 04:00 PM
#1
Thread Starter
Frenzied Member
Simple Error Help [RESOLVED]
I'm only new to PHP, I'm making a simple script and have an simple error can someone help with it please
The Error is Parse error: parse error in /home/httpd/vhosts/httpdocs/includes/test.php on line 29
PHP Code:
<body>
<php
if ($action == "save")
{
echo "save";
$to = "[email protected]";
$subject = "PHP Is Great";
$body = "PHP is one of the best scripting languages around";
$headers = "From: [email][email protected][/email]\n";
mail($to,$subject,$body,$headers);
echo "Mail sent to $to";
}else{
?>
<form method="POST" action="test.php?action=save">
<p><input type="text" name="T1" size="20"></p>
<p><input type="radio" value="V1" name="R1"></p>
<p><input type="radio" value="V2" checked name="R1"></p>
<input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2">
</form>
<?php
}
?>
</body>
Last edited by kiwis; Apr 3rd, 2004 at 11:46 PM.
-
Mar 30th, 2004, 04:29 PM
#2
Frenzied Member
it should be:
PHP Code:
<body>
<?php
if ($action == "save")
{
echo "save";
$to = "[email protected]";
$subject = "PHP Is Great";
$body = "PHP is one of the best scripting languages around";
$headers = "From: [email][email protected][/email]\n";
mail($to,$subject,$body,$headers);
echo "Mail sent to $to";
}else{
?>
<form method="POST" action="test.php?action=save">
<p><input type="text" name="T1" size="20"></p>
<p><input type="radio" value="V1" name="R1"></p>
<p><input type="radio" value="V2" checked name="R1"></p>
<input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2">
</form>
<?php
}
?>
</body>
You'd missed out the ? in the very first <?php
Have I helped you? Please Rate my posts. 
-
Mar 30th, 2004, 07:31 PM
#3
Thread Starter
Frenzied Member
sweet but the email does not send :-( any ideas?
-
Mar 30th, 2004, 09:16 PM
#4
what OS does your server have? if it's windows, do you have SMTP configured? if you're on unix, do you have sendmail installed?
-
Mar 30th, 2004, 10:50 PM
#5
Thread Starter
Frenzied Member
Originally posted by kows
what OS does your server have? if it's windows, do you have SMTP configured? if you're on unix, do you have sendmail installed?
It's unix, it must be turned on this scripts works
PHP Code:
<?php
if ($action == "send")
{
?>
<font class="bluetest2"><strong>THANK YOU</strong></font></p>
<p>Thank you for sending feedback.
<br><br>
<b><a href="http://www.gg.com">Click here to return to
<span lang="en-au"></span> main</a></b>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<?php
if ($name <> "")
{
$message = "From: ";
$message .= $name;
$message .= "\n\n";
}
if ($email <> "")
{
$message = "Email: ";
$message .= $email;
$message .= "\n\n";
}
$message .= $feedback;
/* recipients */
$recipient = "Site Feedback <[email protected]>"; //note the comma
/* subject */
$subject = "Site Feedback";
/* message */
/* additional header pieces for errors, From cc's, bcc's, etc */
$headers .= "From: Feedback \n";
$headers .= "X-Sender: <[email protected]>\n";
$headers .= "X-Mailer: PHP\n"; // mailer
$headers .= "Return-Path: <[email protected]>\n"; // Return path for errors
/* If you want to send html mail, uncomment the following line */
// $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
//$headers .= "cc:[email protected] \n"; // CC to
//$headers .= "bcc:[email protected], [email][email protected][/email] \n"; // BCCs to
/* and now mail it */
mail($recipient, $subject, $message, $headers);
} else {
?>
<br>
<b>You can contact the <span lang="en-au">suppoters</span> Site Webmaster at <a href="mailto:[email protected]">[email protected]</a>.</b><br>
<br><br>
Or you can fill out the form below:
<br><br>
<font class="bluetext2"><strong>Please fill in the feedback form below:</strong></font></p>
<form method="POST" action="contact.php?action=send">
<p><strong>Name:</strong> <font size="3">
<input type="text"
name="name" size="30" style="border-style: solid; border-width: 1"></font> (optional)<br>
<strong>Email:</strong> <font size="3">
<input type="text" name="email" size="30" style="border-style: solid; border-width: 1"></font>
(optional)<br>
<br>
<strong>Feedback:</strong><br>
<font size="3">
<textarea rows="12" name="feedback" cols="50" style="border-style: solid; border-width: 1"></textarea></font><br>
<br>
<br>
<input type="submit" value="Submit Feedback" name="B1" style="border-style: solid; border-width: 1"></p>
</form>
<?php
}
?>
-
Mar 30th, 2004, 11:58 PM
#6
try adding two lines breaks to the end of your message's body.. or some more headers.
-
Mar 31st, 2004, 12:50 AM
#7
Thread Starter
Frenzied Member
Originally posted by kows
try adding two lines breaks to the end of your message's body.. or some more headers.
Got it woking :-)
thanks
However it does not have anything in the body of the email... arr why?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|