Jump to content

[SOLVED] html within an echo unexpected expecting ',' or ';' i


Foser

Recommended Posts

heres my error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in C:\WAMP\www\Projects\LogiPlan\main\admin\user.php on line 21

 

part of code with problems.

if (isset($_POST['delete'])){
echo "Are you sure you want to delete {$username}?<br>";
echo "<form id=\"form1\" name=\"form1\" method=\"post\" action="">
  <label>
  <input type=\"submit\" name=\"yes\" id=\"yes\" value=\"Yes\" />
  </label>
  <label>
  <input type=\"submit\" name=\"no\" id=\"no\" value=\"No\" />
  </label>
</form>"; 
if(isset($_POST['yes'])) {
echo "You have deleted this user. Click <p><a href=\"index.php\">here</a></p> to go back to the admin CP."
mysql_query("DELETE * FROM user_info WHERE username = '$username'"); }
if(isset($POST['no'])){ 
header("Location: user.php?user={$_GET['user']}"); exit; }}

 

</form>";  that is the the line.

The line looks to be this as it gets treated as one line even though its is spread over more than one line:

echo "<form id=\"form1\" name=\"form1\" method=\"post\" action="">
  <label>
  <input type=\"submit\" name=\"yes\" id=\"yes\" value=\"Yes\" />
  </label>
  <label>
  <input type=\"submit\" name=\"no\" id=\"no\" value=\"No\" />
  </label>
</form>";

 

Looks like you forgot to escape the two quotes in action:

echo "<form id=\"form1\" name=\"form1\" method=\"post\" action=\"\">
  <label>
  <input type=\"submit\" name=\"yes\" id=\"yes\" value=\"Yes\" />
  </label>
  <label>
  <input type=\"submit\" name=\"no\" id=\"no\" value=\"No\" />
  </label>
</form>";

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.