Jump to content

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'


cactus

Recommended Posts

Hi,

 

I was wondering if somebody can help me with an error I am getting.

 

Here is my code:

 

if ($_SESSION['username']=='login') {
   if (isset($_REQUEST['file'])) {
       $fc = file_get_contents($_REQUEST['file']);
       $text = explode("<!-- EDITABLE -->",$fc);
       echo "<form method='post' action=''><textarea name='content'>$text[1]</textarea>";
       echo "<p><input type='hidden' name='file' value='".$_REQUEST['file']."' /><input name='submitUpdate' type='submit' value='Update Page'></form>";
   }
   else {
      echo "<p align='center'>
       <a href="index.html">Home Page</a><br/> //THIS IS THE LINE THAT IS GIVING THE ERROR
       <a href="contact_us.html">Contact Us</a><br/>
       <br/>
       <em>Click on the links above to edit the files.</em><br/>
      <a href="?logout">logout</a></p>";
   } 
}

 

 

This code is within php tags is that correct? As I am coding in notepad ++ and it doesn't have any colour which makes me think something is wrong.

 

If someone could help that would be brilliant! Thanks in advance :)

Since your echo uses double quotes for the primary string then you must either escape the double quotes inside, use single quotes or use heredoc.  For example, I would use single quotes for the attribute values:

Home Page

That worked wonders thank you. However there was another error in the first line of the code I posted before would it be possible to help me with that as well?

 

if ($_SESSION['username']=='login') {

 

It says undefined variable _SESSION

 

I've tried using isset but it just gave me the error:

 

Parse error: syntax error, unexpected T_IS_EQUAL, expecting ',' or ')'

 

Hopefully you can help :)

  • 2 weeks later...

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.