Connect with Expertise | Find Experts, Get Answers, Share Insights

Parse error

 
Join Date: Mar 2010
Posts: 3
#1: Mar 1 '10
hi all, i keep getting this error and i'm new to php. i really don't get the error here:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in ...index.php on line 90



line 90:
Expand|Select|Wrap|Line Numbers
  1. echo "<form id="form1" name="form1" method="post" action="start.php?action=<?php echo $Action; ?>&lan= <?php echo $_GET['lan']; ?>&invite=submit">

line 91:
Expand|Select|Wrap|Line Numbers
  1. echo "              <font color=\"#FFFFFF\" face=\"Trebuchet MS\">\n"; 
best answer - posted by numberwhun
Looking at the first line, there are a couple of things wrong right off the bat:

1. You are using double quotes inside of the echo's double quotes, without escaping them.
2. You are trying to use PHP code inside of PHP code (inside of a PHP echo).

This is a much better way to write that statement:

Expand|Select|Wrap|Line Numbers
  1. echo "<form id=\"form1\" name=\"form1\" method=\"post\" action=\"start.php?action=" .$Action. "&lan=" .$_GET['lan']. "&invite=submit\">";
  2.  
Regards,

Jeff

numberwhun's Avatar
E
M
C
 
Join Date: May 2007
Location: New Hampshire, USA
Posts: 2,818
#2: Mar 1 '10

re: Parse error


Looking at the first line, there are a couple of things wrong right off the bat:

1. You are using double quotes inside of the echo's double quotes, without escaping them.
2. You are trying to use PHP code inside of PHP code (inside of a PHP echo).

This is a much better way to write that statement:

Expand|Select|Wrap|Line Numbers
  1. echo "<form id=\"form1\" name=\"form1\" method=\"post\" action=\"start.php?action=" .$Action. "&lan=" .$_GET['lan']. "&invite=submit\">";
  2.  
Regards,

Jeff
 
Join Date: Mar 2010
Posts: 3
#3: Mar 2 '10

re: Parse error


thank you very much! it worked

but now i get the next error and i tried lots of things but again can't get it fixed :(

Parse error: syntax error, unexpected T_IF, expecting ',' or ';' in index.php on line 98

Expand|Select|Wrap|Line Numbers
  1. echo "              <input type=\"text\" name=\"addy\" id=\"search_box\" class='search_box'/>\n"; 
  2. echo "              <input type=\"submit\" value=\"Send Invite\" class=\"search_button\" /><br />\n";
  3. echo " 
  4. echo "                    if ($_GET['invite'] == submit){
  5. echo "                 $invitation = $_POST['addy'];
  6. echo "                    if ($invitation == ""){
  7. echo "                    echo '<SCRIPT LANGUAGE="JavaScript"> alert ("Put something in the Emailfield!") </SCRIPT>';
  8. echo "                }else{
  9. echo "                    include("invite.php");
  10. echo "                }
  11. echo "                }
line 98 is with the first if...
Dormilich's Avatar
E
M
C
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 5,234
#4: Mar 2 '10

re: Parse error


I’m 99.99% sure you don’t intend to print out the if statement, do you?
Dormilich's Avatar
E
M
C
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 5,234
#5: Mar 2 '10

re: Parse error


what error? lines 3 to 11 don’t need an echo statement either.
 
Join Date: Mar 2010
Posts: 3
#6: Mar 2 '10

re: Parse error


i removed all echos from those lines and now it works, only removed the echos before the if previously >_>

sorry and thanks for the help! can be closed
Dormilich's Avatar
E
M
C
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 5,234
#7: Mar 2 '10

re: Parse error


@spelaben
denied ;)
johny10151981's Avatar
C
 
Join Date: Jan 2010
Location: Japan
Posts: 167
#8: Mar 3 '10

re: Parse error


hey, sehe gerade, dass du aus deutschland kommst. also ich bin ein anfänger und ich nehme mal an du meinst das mit dem echo? muss das vorm if weg? wenn ja, das hab ich schon probiert und dann kommt wieder ein anderer fehler...
is this acceptable? i didnt understand anything.
Dormilich's Avatar
E
M
C
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 5,234
#9: Mar 3 '10

re: Parse error


@johny10151981
no, it isn’t. but an infraction has already been given. it basically says, that errors remained.
Reply

Tags
error, parse, php