cactus Posted March 14, 2011 Share Posted March 14, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/230613-parse-error-syntax-error-unexpected-t_string-expecting-or/ Share on other sites More sharing options...
Maq Posted March 14, 2011 Share Posted March 14, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/230613-parse-error-syntax-error-unexpected-t_string-expecting-or/#findComment-1187412 Share on other sites More sharing options...
cactus Posted March 14, 2011 Author Share Posted March 14, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/230613-parse-error-syntax-error-unexpected-t_string-expecting-or/#findComment-1187418 Share on other sites More sharing options...
kenrbnsn Posted March 14, 2011 Share Posted March 14, 2011 You need to have <?php session_start(); ?> at the very beginning of each script where you use the $_SESSION array. Ken Quote Link to comment https://forums.phpfreaks.com/topic/230613-parse-error-syntax-error-unexpected-t_string-expecting-or/#findComment-1187507 Share on other sites More sharing options...
Maq Posted March 29, 2011 Share Posted March 29, 2011 (New topic link from hijacker - http://www.phpfreaks.com/forums/index.php?topic=328749.0) Quote Link to comment https://forums.phpfreaks.com/topic/230613-parse-error-syntax-error-unexpected-t_string-expecting-or/#findComment-1193725 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.