Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7823

Re: HP syntax error, unexpected T_variable

From The Natural Philosopher <tnp@invalid.invalid>
Newsgroups comp.lang.php
Subject Re: HP syntax error, unexpected T_variable
Date 2012-12-17 17:30 +0000
Organization albasani.net
Message-ID <kankqv$4oa$2@news.albasani.net> (permalink)
References <kanjie$4pm$1@speranza.aioe.org>

Show all headers | View raw


On 17/12/12 17:08, Twayne wrote:
> I'm still fighting the error message below over two days now. I'm back again
> hopefully
> simplifying my question to get more answers. So far I've had no hint what
> the syntax error is. As a neophyte I'm trying to work down thru one problem
> at a time so it's a learning experience, too. I've looked at several other
> scripts and they seem to do the same thing I'm doing.
>     PHP 5.3.5 on XP Pro SP3+, Apache 2.2 local server.
>
> ------------------------
>
> <?php
> if(isset($_POST['email'])) {
>
>    $email_to=me@example.com;
> /*
> Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\send.php
> on line 5
> */
> ...
> ?>
> ----------------------------
>
> I've also tried it with single/double quotes; no help. I just can NOT figure
> out what the Syntax error would be.
>
> If I comment out that line, I get more such messages at other places in the
> script so I'm doing something stupid here, I know! WHAT is the syntax
> problem with $email_to="me@example.com? (My own address removed)
>
> For those who may wish to see the complete code of send.php, here it is:
> ==============
>
> <?php
> if(isset($_POST['email'])) {
> $email="twayne@twaynesdomain.com";
> }
> /*
> Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\send.php
> on line 5
> */
>
>
>   $subject = 'From the Web Site';
>      function died($error) {
>         // your error code can go here
>          echo "We are very sorry, but there were error(s) found with  // the
> form you submitted. ";
> }
>
>            // validation expected data exists
>      if(!isset($_POST['email']) ||
>          !isset($_POST['subject']) ||
>          !isset($_POST['comments'])) {
>          died('We are sorry, but there appears to be a problem with the form
> you submitted.');
>      }
>
>
>      $email = $_POST {'email']; //required

*****************one syntax error right there


>      $subject = $_POST['subject']; // required
>      $comments = $_POST['comments']; // required
> }
>
> echo '$email';
> echo '$subject';
> echo '$comments';
>
>
>
>
>      $error_message = "";
>      $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
>    if(!preg_match($email_exp,$email_from)) {
>      $error_message .= 'The Email Address you entered does not appear to be
> valid.<br />'};
>    }
>      $string_exp = "/^[A-Za-z .'-]+$/";
>    if(!preg_match($string_exp,$email) {
>      $error_message .= 'The Email Address you entered does not appear to be
> valid.<br />'};
>    }
>    if(!preg_match($string_exp,$subject)) {
>      $error_message .= 'The Subject you entered does not appear to be
> valid.<br />'};
>    }
>    if(strlen($comments) < 2) {
>      $error_message .= 'The Comments you entered do not appear to be
> valid.<br />'};
> }
>
>    if(strlen($error_message) > 0) {
>      died($error_message);
>    }
>      $email_message = "Form details below.\n\n";
>
>      function clean_string($string) {
>        $bad = array("content-type","bcc:","to:","cc:","href");
>        return str_replace($bad,"",$string);
>      }
>
>      $email_message .= "Email: ".clean_string($email_from)."\n";
>      $subject .= 'subject: " . .clean_string($subject). "/n?;
>      $email_message .= "Comments: ".clean_string($comments)."\n";
>
>
> // create email headers
> $headers = 'From: '.$email_from."\r\n".
> 'Reply-To: '.$email_from."\r\n" .
> 'X-Mailer: PHP/' . phpversion();
> @mail($email_to, $email_subject, $email_message, $headers);
> ?>
>
> <!-- include your own success html here -->
>
> Thank you for contacting us. We will be in touch with you very soon.
> */
>
> <?php
> }
> ?>
> ============
>
> HTH,
>
> Twayne`
>


-- 
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to 
lead are elected by the least capable of producing, and where the 
members of society least likely to sustain themselves or succeed, are 
rewarded with goods and services paid for by the confiscated wealth of a 
diminishing number of producers.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

HP syntax error, unexpected T_variable "Twayne" <nobody@devnull.spamcop.net> - 2012-12-17 12:08 -0500
  Re: HP syntax error, unexpected T_variable "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-17 18:19 +0100
    Re: HP syntax error, unexpected T_variable "Twayne" <nobody@devnull.spamcop.net> - 2012-12-17 12:44 -0500
      Re: HP syntax error, unexpected T_variable Denis McMahon <denismfmcmahon@gmail.com> - 2012-12-17 18:05 +0000
  Re: HP syntax error, unexpected T_variable The Natural Philosopher <tnp@invalid.invalid> - 2012-12-17 17:30 +0000
  Re: HP syntax error, unexpected T_variable Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-18 00:51 +0100
    Re: HP syntax error, unexpected T_variable Jerry Stuckle <jstucklex@attglobal.net> - 2012-12-17 19:51 -0500
      Re: HP syntax error, unexpected T_variable "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-18 12:36 +0100
        Re: HP syntax error, unexpected T_variable Jerry Stuckle <jstucklex@attglobal.net> - 2012-12-18 07:10 -0500
          Re: HP syntax error, unexpected T_variable "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-12-18 14:11 +0100
            Re: HP syntax error, unexpected T_variable Jerry Stuckle <jstucklex@attglobal.net> - 2012-12-18 11:50 -0500
              Re: HP syntax error, unexpected T_variable Adam Harvey <usenet@adamharvey.name> - 2012-12-19 02:02 +0000
                Re: HP syntax error, unexpected T_variable Jerry Stuckle <jstucklex@attglobal.net> - 2012-12-18 21:23 -0500
                Re: HP syntax error, unexpected T_variable "Twayne" <nobody@devnull.spamcop.net> - 2012-12-18 21:41 -0500
    RESOLVED! Re: HP syntax error, unexpected T_variable "Twayne" <nobody@devnull.spamcop.net> - 2012-12-17 20:56 -0500
      Re: RESOLVED! Re: HP syntax error, unexpected T_variable Denis McMahon <denismfmcmahon@gmail.com> - 2012-12-18 17:34 +0000

csiph-web