Jump to content

[SOLVED] Echo? why wont you echo?!


Gnub

Recommended Posts

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>";

?>

 

 

Link to comment
Share on other sites

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.'">';

Link to comment
Share on other sites

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']}

Link to comment
Share on other sites

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>";

?>

Link to comment
Share on other sites

 

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?

Link to comment
Share on other sites


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.

Link to comment
Share on other sites

: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>";

Link to comment
Share on other sites

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;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.