kaz Posted February 28, 2005 Posted February 28, 2005 Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/deathea/public_html/khaleel/html/userarea.php on line 76 Line 76 Reads ><font face='Verdana' size='1'>Welcome Back <?php print $_SESSION['user']; // Print out admin links if($_SESSION['permission'] > 1){ <a href = 'modUser.php'>mod user</a>|<a href = 'delUser.php'>del user</a>|<?php } ?></font> I need help with this, can anyone help me please? Quote
kaz Posted February 28, 2005 Author Posted February 28, 2005 Please dont shout sir for bumping but I really need help Quote
TCH-Bruce Posted February 28, 2005 Posted February 28, 2005 Please read the fourm guidlines. o Family Members may not bump threads. Only 2 hours have past since you posted your question. Maybe someone who could help has not read the post yet. I know you are looking for an answer and if someone knows the answer I am sure they will respond. Quote
TCH-Don Posted February 28, 2005 Posted February 28, 2005 To be honest I think more info is needed. like what script and a link and when the error is displayed the more info the better. And remember most of the family here may be at work during the day. Quote
owatagal Posted March 1, 2005 Posted March 1, 2005 I don't know about the error specifically, but right now the PHP has a second opening tag in the middle of it and the html within the brackets isn't set up to actually do anything--the PHP engine is trying to render it as PHP and not HTML, I think. Which could be enough to trigger that error. Try: ><font face='Verdana' size='1'>Welcome Back <?php print $_SESSION['user']; if ($_SESSION['permission'] > 1) { echo "<a href='modUser.php'>mod user</a>|<a href='delUser.php'>del user</a>"; } ?> </font> One word of warning--the way it's set right now, it would be possible for someone to randomly set up a permission value of, say 1000, and it would print out this bit of menu. If you know the actual permission values of your admin users, it would be better to set up something like >if ($_SESSION'permission'] == (1|2|3)) { I'm not certain that's the exact syntax, but something like that would be more secure--look for an exact permissions match, instead of "any number greater than 1." Quote
borfast Posted March 1, 2005 Posted March 1, 2005 In your original code, you just missed the first closing PHP tag (right before the HTML string): <font face='Verdana' size='1'>Welcome Back <?php print $_SESSION['user']; // Print out admin links if($_SESSION['permission'] > 1){ ?> <a href = 'modUser.php'>mod user</a>|<a href = 'delUser.php'>del user</a>|<?php } ?></font> Quote
kaz Posted March 2, 2005 Author Posted March 2, 2005 Did not fix all of the code, problem was example ><?php echo'<a href="page.asp?go=shop">Go the shop</a>'; // as you can see, the quotes are " and should be ' ?> It should be ><?php echo"<a href='Page.aspx?Go=Shop'>Go the shop</a>"; // quotes are fine and work they should be ' ?> Done thanks all anyways Quote
borfast Posted March 3, 2005 Posted March 3, 2005 // as you can see, the quotes are " and should be ' Try putting a space between the "echo" and the first quote. Both the examples you gave should work just fine. Quote
matman Posted March 3, 2005 Posted March 3, 2005 Actually, Kaz, changing the quotes from " to ' in your HTML is not correct, although it will work on many or perhaps most web browsers. What you want to do is type in /" when you are typing a string to be output to the browser and need to have a quote. The backslash is the "escape code" -- it tells PHP "No, this isn't the end of my string; I want to put an ACTUAL quote mark INSIDE the string, please!" ><?php echo "<a href=\"Page.aspx?Go=Shop\">Go the shop</a>"; ?> See this link for more complete info on how to format PHP strings: PHP Manual page on string data Quote
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.