Author Topic: parse error, strange one  (Read 1895 times)

0 Members and 1 Guest are viewing this topic.

area32

  • Guest
parse error, strange one
on: Wed, 10. March 2004 - 00:31:45
Hi,

I work on a simple contactscript but I have a hard parse error and can't find it.
My code:
Code: [Select]
?

session_start;

#################################################

## contact.php

## Contactformulier voor bezoekers.

## Versie 2.0

##################################################

error_reportingE_ALL;

requirevlib/vlibTemplate.php;

requirevlib/vlibMimeMail.php;

requireinc/config.inc.php;

requireinc/functions.php;



# Template stuff

$tmpl = new vlibTemplateDebug'templates/contact.html';



if$_POST



$tmpl-setVar'post', 1;



# Begin foutcontrole

$foutje = 0;



ifempty$_POST'van_naam'



  $tmpl-setVar'empty_van_naam', 1;

   $foutje = 1;

  

  

  ifempty$_POST'van_email'

  

   $tmpl-setVar'empty_van_email', 1;

   $foutje = 1;

  

  

  if!ereg^A-Za-z0-9_-+@A-Za-z0-9_-+.A-Za-z0-9_-+.*, $_POST'van_email'

  

   $tmpl-setVar'error_van_email', 1;

   $foutje = 1;

  

  

  ifempty$_POST'onderwerp'

  

   $tmpl-setVar'empty_subject', 1;

   $foutje = 1;

  

  

  ifempty$_POST'bericht'

  

   $tmpl-setVar'empty_bericht', 1;

   $foutje = 1;

  

 

  if$foutje == 0

  

   # No errors, send mail

   $p-email = $_POST'van_email';

   $p-name = $_POST'van_naam';

   $p-subject = $_POST'onderwerp';

   $p-message = $_POST'bericht';

  

   $mail= new vlibMimeMail;

  

   $mail-to'[email protected]', 'F2B Staff;

     $mail-from$p-email, $p-name;

    

     $p-subject = F2B-.$site-host.-.$p-subject;

     $mail-subject$p-subject;

    

     $p-message = nl2br$p-message;

     $p-message = strip_tags$p-message;

     $mail-body$p-message;

        

        $mail-send;

        

        $p-message = nl2br$p-message;



        # Parse error parse error in /opt/www/user/web/ssr_site/contact.php on line 78

        $tmpl-setVar'mail_message', $p-message;

        $tmpl-setVar'send', 1;





else



  # Errors were found, send no e-mail

  





else



# Show form



$tmpl-pparse;

?

I get Parse error: parse error in /opt/www/user/web/ssr_site/contact.php on line 78 (see same comment in code.
When I remove the line, it give a parse error to the next $tmpl->setVar() line.

My template code:
Code: [Select]
h2Contact the F2B.be staff/h2



tmpl_if name=post

tmpl_if name=error2

  pThere are some errors/p

  p

  tmpl_if name=empty_van_naam

  liName field is empty!

  /tmpl_if

  

  tmpl_if name=empty_van_email

  liE-mail field is empty!

  /tmpl_if

  

  tmpl_if name=error_van_email

  liWrong e-mail format!

  /tmpl_if

  

  tmpl_if name=empty_subject

  liSubject field is empty!

  /tmpl_if

  

  tmpl_if name=empty_bericht

  liMessage field is empty!

  /tmpl_if

  /p

  pGo a href='javascripthistory.go-1'back/a and fix it./p

  

/tmpl_if



tmpl_if name=send



  piMail has been send./i/p

  pYour messagebr

  blockquote!--tmpl_var name='mail_message'--/blockquote/p



/tmpl_if



tmpl_else



form method=POST action=tmpl_var name=__SELF__

center

pYour name brinput type=text name=van_naam size=50br

Your email brinput type=text name=van_email size=50br

Subjectbr input type=text name=onderwerp size=50br

Message brtextarea rows=10 cols=50 name=bericht/textareabr

  

input type=submit value=Send it to the staffinput type=reset value=Reset/form/p

/center



/tmpl_if

I never had this problem before in other scripts.

Thanks,

releasedj

  • Guest
parse error, strange one
Reply #1 on: Wed, 10. March 2004 - 13:53:56
The only thing that looks a little odd is that you set $p to a string variable, i.e.:
$p = $p->message;

... then try to access the string variable as if it were still an object, i.e.:
$tmpl->setVar('mail_message', $p->message);

Try removing the $p = $p->message; line and see if it makes a difference.

area32

  • Guest
parse error, strange one
Reply #2 on: Wed, 10. March 2004 - 18:49:56
Quote
Try removing the $p = $p->message; line and see if it makes a difference.


Same problem without this line, I know this line was a mistake but it was a test line.

releasedj

  • Guest
parse error, strange one
Reply #3 on: Wed, 10. March 2004 - 20:48:29
The problem probably lies here:

$mail->to('[email protected]', 'F2B Staff);

You have not closed the single quote.

The next single quote is where setVar is called.

Regards,

Kelvin

area32

  • Guest
parse error, strange one
Reply #4 on: Wed, 10. March 2004 - 22:22:03
thanks, now it works fine