1
ivan8r
Parse error: parse error, unexpected T_INCLUDE
  • 2005/6/3 8:40

  • ivan8r

  • Just popping in

  • Posts: 57

  • Since: 2003/10/1


I'm writing a small email script, and I keep getting the error:

Quote:
Parse error: parse error, unexpected T_INCLUDE in /home/www/customfirearmfinishes.com/brochure/modules/email/email.php on line 2


Here is my script...

Quote:
[? php

$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$message = $_REQUEST['message'];

mail ("x@yz.com", "Email from yz.com", "From: $email", "Name: $name", $message);
header ("Location:http://www.yz.com/brochure/modules/thanks/thanks.php");
?]


I've been searching around several forums, and everything I've written here looks correct. Can anybody tell me where I've goofed?

ivan8r

2
Catzwolf
Re: Parse error: parse error, unexpected T_INCLUDE
  • 2005/6/3 9:42

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


You are using [? php ?] instead of <?php ?>

I also think that you should use the XOOPS mail function for this as it' safer.

<?php 
// please change this to match you dir structure
include 'mainfile.php';

$myts = &MyTextSanitizer :: getInstance();

$send_email "x@yz.com";
$subject "Email from yz.com";
$name $myts -> stripSlashesGPCtrim$_REQUEST['name'] ) );
$email $myts -> stripSlashesGPCtrim$_REQUEST['email'] ) );
$message $myts -> stripSlashesGPCtrim$_REQUEST['message'] ) );

$xoopsMailer = &getMailer();
$xoopsMailer -> useMail();
$xoopsMailer -> setToEmails$send_email );
$xoopsMailer -> setFromEmail$email );
$xoopsMailer -> setFromName$name );
$xoopsMailer -> setSubject$subject );
$xoopsMailer -> setBody$message );

$_on_error = ( $xoopsMailer -> send() ) ? "Sending email was ok" "Error sending email"
redirect_header"redirect_url.php"3$_on_error );

?>

3
ivan8r
Re: Parse error: parse error, unexpected T_INCLUDE
  • 2005/6/17 9:34

  • ivan8r

  • Just popping in

  • Posts: 57

  • Since: 2003/10/1


I used the code you gave me and I received the following error:

Quote:
Parse error: parse error, unexpected T_STRING in /home/www/xyz.com/modules/email/email.php on line 22



The code contained on line 22 is:

Quote:
redirect_header( "http://www.xyz.com/modules/thanks/thanks.php", 3, $_on_error );


I verified that the url is valid, so I'm not sure why I'm getting this error.

4
wcrwcr
Re: Parse error: parse error, unexpected T_INCLUDE
  • 2005/6/17 10:44

  • wcrwcr

  • Home away from home

  • Posts: 1114

  • Since: 2003/12/12


Hi

BTW> are you using php5?
Xoops is only compatible with php5 after version 2.09xx

Hope it helps

5
ivan8r
Re: Parse error: parse error, unexpected T_INCLUDE
  • 2005/6/17 22:26

  • ivan8r

  • Just popping in

  • Posts: 57

  • Since: 2003/10/1


Using php 4.3.10.

I copied the code offered by Anonymous almost exactly as shown in his post. In line 22, after the email address is a 3. What does the 3 refer to?

I'm getting much better with php now, but I'm still FAR from being good at it. I guess my biggest problem is that I don't understand the error codes that well. I'm not sure what a parse error is. I don't know what a T_STRING is either.

Thanks all for your help so far.

Login

Who's Online

115 user(s) are online (69 user(s) are browsing Support Forums)


Members: 0


Guests: 115


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits