Porkie Posted August 31, 2009 Share Posted August 31, 2009 im confused with the problem i get here? <?php if ($stuff['type'] == 'Administrator'){ echo '<a href="password_protected.php">Add/Edit/Delete RSS Feeds</a><br/><br/>'; echo '<a href="admin.php">Main Site Admin</a><br/><br/>'; echo '<SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/s/a?url=www.ssa.co.uk'></SCRIPT>'; echo '<SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/t/a?url=www.ssa.co.uk'></SCRIPT>'; } ?> Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/myuklive/public_html/details.php on line 36 i dont see a problem with it? Cheers Quote Link to comment https://forums.phpfreaks.com/topic/172592-confusion-at-problem/ Share on other sites More sharing options...
mikesta707 Posted August 31, 2009 Share Posted August 31, 2009 many problems. mainly that you have to escape your single quotes if your entire string is encased in them if ($stuff['type'] == 'Administrator'){ echo '<a href="password_protected.php">Add/Edit/Delete RSS Feeds</a><br/><br/>'; echo '<a href="admin.php">Main Site Admin</a><br/><br/>'; echo '<SCRIPT type=\'text/javascript\' language=\'JavaScript\' src=\'http://xslt.alexa.com/site_stats/js/s/a?url=www.ssa.co.uk\'></SCRIPT>'; echo '<SCRIPT type=\'text/javascript\' language=\'JavaScript\' src=\'http://xslt.alexa.com/site_stats/js/t/a?url=www.ssa.co.uk\'></SCRIPT>'; } conversely, instead of escaping them "\'" you could just use double quotes Quote Link to comment https://forums.phpfreaks.com/topic/172592-confusion-at-problem/#findComment-909814 Share on other sites More sharing options...
wildteen88 Posted August 31, 2009 Share Posted August 31, 2009 This is wrong echo '<SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/s/a?url=www.ssa.co.uk'></SCRIPT>'; echo '<SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/t/a?url=www.ssa.co.uk'></SCRIPT>'; You need to use " around your html attribute values. echo '<SCRIPT type="text/javascript" language="JavaScript" src="http://xslt.alexa.com/site_stats/js/s/a?url=www.ssa.co.uk"></SCRIPT>'; echo '<SCRIPT type="text/javascript" language="JavaScript" src="http://xslt.alexa.com/site_stats/js/t/a?url=www.ssa.co.uk"></SCRIPT>'; Quote Link to comment https://forums.phpfreaks.com/topic/172592-confusion-at-problem/#findComment-909815 Share on other sites More sharing options...
p2grace Posted August 31, 2009 Share Posted August 31, 2009 *EDIT* You could also alternatively use heredoc. <?php if ($stuff['type'] == 'Administrator'){ echo <<<HTML <a href="password_protected.php">Add/Edit/Delete RSS Feeds</a><br/><br/> <a href="admin.php">Main Site Admin</a><br/><br/> <SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/s/a?url=www.ssa.co.uk'></SCRIPT> <SCRIPT type='text/javascript' language='JavaScript' src='http://xslt.alexa.com/site_stats/js/t/a?url=www.ssa.co.uk'></SCRIPT> HTML; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/172592-confusion-at-problem/#findComment-909817 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.