Gnub Posted February 16, 2007 Share Posted February 16, 2007 Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in URL/CVSReturn.php on line 28 Line 28 points to the <form name... > line. Spent 20 min looking over this without any luck at solving the problem. Anyone able to point out where i've gone wrong? <?PHP echo "<BR><BR>"; echo "<table bordercolor="#F2DC77" border="1" align="center" width="600" cellpadding="1">"; echo "<form name="frmSearch" action="UpdateTeletext.php" method="post">"; echo "<tr><td bgcolor="#F8BC07" colspan="4" align="center">Record Fields...</td></tr>"; echo "<td>OfferID: <input type="text" value="$row['Offer ID']" name="OfferID"/></td>"; echo "<tr><td align="center">Price: <input type="text" name="Price" /></td>"; echo "<td align="center">Flight: <input type="text" name="FLIGHTS" /></td>"; echo "<td align="center">Accom: <input type="text" name="ACCOM" /></td>"; echo "<td align="center">Total: <input type="text" name="TOTAL" /></td></tr>"; ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 16, 2007 Share Posted February 16, 2007 You're opening your strings with ". Then inside them you have more ". If you want to use a quote inside a string you opened with that same quote, you have to escape it with a \. If I were you I'd open the strings with ' so you don't have to escape all your " and then just pop out of it for your one variable. echo '<form name="frmSearch">'; etc. echo '<inout type="text" value="'.$val.'">'; Quote Link to comment Share on other sites More sharing options...
printf Posted February 16, 2007 Share Posted February 16, 2007 You enclose the echo with ", but you use " in the enclosed string, so you need to escape \" in all your enclosed strings. <?php echo "<BR><BR>"; echo "<table bordercolor=\"#F2DC77\" border=\"1\" align=\"center\" width=\"600\" cellpadding=\"1\">"; echo "<form name=\"frmSearch\" action=\"UpdateTeletext.php\" method=\"post\">"; echo "<tr><td bgcolor=\"#F8BC07\" colspan=\"4\" align=\"center\">Record Fields...</td></tr>"; echo "<td>OfferID: <input type=\"text\" value=\"" . $row['Offer ID'] . "\" name=\"OfferID\"/></td>"; echo "<tr><td align=\"center\">Price: <input type=\"text\" name=\"Price\" /></td>"; echo "<td align=\"center\">Flight: <input type=\"text\" name=\"FLIGHTS\" /></td>"; echo "<td align=\"center\">Accom: <input type=\"text\" name=\"ACCOM\" /></td>"; echo "<td align=\"center\">Total: <input type=\"text\" name=\"TOTAL\" /></td></tr>"; ?> Also if your using an array element $row['Offer ID'], then you should dot => " . $row['Offer ID'] . ", or enclose it {$row['Offer ID']} Quote Link to comment Share on other sites More sharing options...
mjurmann Posted February 16, 2007 Share Posted February 16, 2007 Make sure to escape your " when you echo things out by simple adding a \ before every " inside of the echo (not including the first " right after echo, or the " right before the semi-colon <?PHP echo "<BR><BR>\"; echo "<table bordercolor=\"#F2DC77\" border=\"1\" align=\"center\" width=\"600\" cellpadding=\"1\">"; echo "<form name=\"frmSearch\" action=\"UpdateTeletext.php\" method=\"post\">\"; echo "<tr><td bgcolor=\"#F8BC07\" colspan=\"4\" align=\"center\">Record Fields...</td></tr>"; echo "<td>OfferID: <input type=\"text\" value=\"$row['Offer ID']\" name=\"OfferID\"/></td>"; echo "<tr><td align=\"center\">Price: <input type=\"text\" name=\"Price\" /></td>"; echo "<td align=\"center\">Flight: <input type=\"text\" name=\"FLIGHTS\" /></td>"; echo "<td align=\"center\">Accom: <input type=\"text\" name=\"ACCOM\" /></td>"; echo "<td align=\"center\">Total: <input type=\"text\" name=\"TOTAL\" /></td></tr>"; ?> Quote Link to comment Share on other sites More sharing options...
Gnub Posted February 16, 2007 Author Share Posted February 16, 2007 cheers all! Quote Link to comment Share on other sites More sharing options...
Gnub Posted February 16, 2007 Author Share Posted February 16, 2007 Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /content/StartupHostPlus/c/o/completetravel.co.uk/web/CVSReturn.php on line 28 Points to echo "<table bordercolor=#F2DC77 border=\"1\" align=\"center\" width=\"600\" cellpadding=\"1\">"; thoughts? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 16, 2007 Share Posted February 16, 2007 What are the few lines before that one? Some times the error is before the line indicated. Ken Quote Link to comment Share on other sites More sharing options...
Gnub Posted February 16, 2007 Author Share Posted February 16, 2007 echo "<BR><BR>\"; echo "<table bordercolor=#F2DC77 border=\"1\" align=\"center\" width=\"600\" cellpadding=\"1\">"; Before these two lines, the While statment is there, for posting data to the screen. all of which are working fine. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 16, 2007 Share Posted February 16, 2007 echo "<BR><BR>\"; You're escaping one you shouldn't there - of course, if you'd taken my advice, that wouldn't happen, but no, no one's listening to me today. Quote Link to comment Share on other sites More sharing options...
Gnub Posted February 16, 2007 Author Share Posted February 16, 2007 :S sorry J. if it makes you feel any better... Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING for echo "<td>OfferID: <input type=\"text\" value=\"$row['Offer ID']\" name=\"OfferID\"/></td>"; Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 16, 2007 Share Posted February 16, 2007 You have to start looking for these yourself. It's probably the line before or after. We're not going to go through and pick out every typo you make, that's up to you. Quote Link to comment Share on other sites More sharing options...
mbtaylor Posted February 16, 2007 Share Posted February 16, 2007 You might want to use the Heredoc method, I find it useful sometimes. You can use variables double and single quotes in a Heredoc print statement. Just make sure the last HTML; is on its own line with no whitespace infront of it or it wont work! Note the HTML can actually be any word (dont want to confuse you). Read the PHP Manual Print page for more information. print <<<HTML; <BR><BR> <table bordercolor="#F2DC77" border="1" align="center" width="600" cellpadding="1"> <form name="frmSearch" action="UpdateTeletext.php" method="post"> <tr><td bgcolor="#F8BC07" colspan="4" align="center">Record Fields...</td></tr> <td>OfferID: <input type="text" value="$row['Offer ID']" name="OfferID"/></td> <tr><td align="center">Price: <input type="text" name="Price" /></td> <td align="center">Flight: <input type="text" name="FLIGHTS" /></td> <td align="center">Accom: <input type="text" name="ACCOM" /></td> <td align="center">Total: <input type="text" name="TOTAL" /></td></tr> HTML; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.