Parse error: syntax error, unexpected T_STRING in ..........

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sabsin
Forum Newbie
Posts: 3
Joined: Mon Mar 10, 2008 12:54 pm

Parse error: syntax error, unexpected T_STRING in ..........

Post by sabsin »

Everah | Please use the appropriate bbCode tags when posting code in the forms. You can use [code], [{lang}] or [syntax="{lang}"] where {lang} is the language you want to highlight as.

Everah | Please post in the correct forums.

Hi ! i'm facing t- String error for my feebback form

Parse error: syntax error, unexpected T_STRING in /home/ezines/public_html/savefeedback.php on line 19

below is the code.. pls help me to figure out the problem
------------------------------------------------------------

Code: Select all

<?php
    ob_start();
    echo "<pre>";
    print_r($_POST);
    
    $con = mysql_connect("localhost","ezines_india","ezines123");
    if (!$con)
    {
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db("ezines_inquiry",$con);
    
    mysql_query("INSERT INTO ezines_inquiry VALUES ('".$_POST['name']."', '".$_POST['address']."','".$_POST['phone']."','".$_POST['email']."','".$_POST['comments']."')");
    
    $msg = "Thank You for Your Inquiry.\n\nWe will get back to you shortly.\n\nWith Best Regards\nSaba";
    mail($_POST['email'],"Inquiry Mail",$msg);
    $msg = "Name : ".$_POST['name']."\nAddress : ".$_POST['address']."\nPhone : ".$_POST['phone']."\nEmail : ".$_POST['email']."\nComments : ".$_POST['comments'];
    mail("ansari_saba@yahoo.co.in","Inquiry Mail",$msg)
    mysql_close($con);
    header("Location: thanks.php");
?>
-------------------------------------------------------------------------------------
Problem can be seen at http://www.ezinesindia.com/inquiry.php


thanx

Sabs

Everah | Please use the appropriate bbCode tags when posting code in the forms. You can use [code], [{lang}] or [syntax="{lang}"] where {lang} is the language you want to highlight as.
Last edited by RobertGonzalez on Thu Mar 13, 2008 11:38 am, edited 1 time in total.
Reason: bbCode tags note, correct forums note
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Parse error: syntax error, unexpected T_STRING in ..........

Post by alex.barylski »

Code: Select all

mail("ansari_saba@yahoo.co.in","Inquiry Mail",$msg)
Your missing a closing semi-colon at the end of that statement -- that will cause an issue -- not sure if it's the one you are having though. :P

p.s-Format your code nicely and use PHP blocks it makes diagnosing much easier.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: Parse error: syntax error, unexpected T_STRING in ..........

Post by Jenk »

General Discussion

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.
sabsin
Forum Newbie
Posts: 3
Joined: Mon Mar 10, 2008 12:54 pm

Re: Parse error: syntax error, unexpected T_STRING in ..........

Post by sabsin »

thank you it's working

p.s-Format your code nicely and use PHP blocks it makes diagnosing much easier.

can I hv a hint of it...PHP blocks ? how 2 use it :(
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Parse error: syntax error, unexpected T_STRING in ..........

Post by Chris Corbyn »

sabsin wrote:thank you it's working

p.s-Format your code nicely and use PHP blocks it makes diagnosing much easier.

can I hv a hint of it...PHP blocks ? how 2 use it :(
Effectively, any time you go inside a curly brace, indent your code by 1 tab, or some fixed number of spaces.

Code: Select all

class Foo
{
  //Everything is indented because of the curly
  var $something;
  
  function bar()
  {
    //Everything is idented even more because of the curly
    $x = 0;
    while ($x < 10)
    {
      //everything is indented yet again because of the curly
      $x++;
    }
  }
 
}
It's not a syntax thing, just a way to make you code easier to read that's all ;)
sabsin
Forum Newbie
Posts: 3
Joined: Mon Mar 10, 2008 12:54 pm

Re: Parse error: syntax error, unexpected T_STRING in ..........

Post by sabsin »

thanx a tons :)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Parse error: syntax error, unexpected T_STRING in ..........

Post by RobertGonzalez »

Moved to PHP - Code.
Post Reply