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.

Link to comment
Share on other sites

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

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.