Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

PHP unexpected T_CONSTANT_ENCAPSED_STRING HELP!

Posted on 2003-03-09
11
Medium Priority
?
731 Views
Last Modified: 2013-12-13
Well, I think my script is valid, but it returns various unexpected T_CONSTANT_ENCAPSED_STRINGs...

Here it is, all my points to anyone who can help...

<?php

$iconnumbertwo = $iconnumber - 1;

print ("<html><head><title></title><link rel=stylesheet href='css1.css' type='text/css'></head><body><center><?php include 'topbanner.php'; ?><?php include 'leftmenu.php'; ?><td valign='top'><table width='500' border='0'><?php include 'iconsnav.php'; ?><tr><td class='regulartitle'>");

print ("Icons: $bandname [$iconnumber]");

print ("</td><tr><td class='newstbl'>");

while ($iconnumber > 0)
{

$iconnumbertwo = $iconnumbertwo - 1;
print ("<a href='aim:BuddyIcon?src=http://www.punkaim.com/theicons/");
print ($abrev);
print ($iconnumertwo);
print (".gif'>");
print ("<img src='http://www.punkaim.com/theicons/');
print ($abrev);
print ($iconnumertwo);
print ("'.gif'")
print ("border='0'></a>");

}

print ("</td></td></tr></table>");
print ("</td><?php include 'rightmenu.php'; ?>");
print ("<?php include 'bottompage.php'; ?>");
print ("</body></html>");


?>
0
Comment
Question by:doctacrazy
8 Comments
 

Accepted Solution

by:
__macro__ earned 248 total points
ID: 8101568
You need read more about issue the tags <?php  ?>
Good example:
<?php
if ($expression) {
   ?>
   <strong>This is true.</strong>
   <?php
} else {
   ?>
   <strong>This is false.</strong>
   <?php
}
?>


This works as expected, because when PHP hits the ?> closing tags, it simply starts outputting whatever it finds until it hits another opening tag.
0
 
LVL 6

Expert Comment

by:carchitect
ID: 8104586
which line sir
0
 

Assisted Solution

by:bcouldrey
bcouldrey earned 244 total points
ID: 8108100
Change your last 4 lines

FROM:
print ("</td></td></tr></table>");
print ("</td><?php include 'rightmenu.php'; ?>");
print ("<?php include 'bottompage.php'; ?>");
print ("</body></html>");


TO:
print ("</td></td></tr></table>");
print ("</td>");
include 'rightmenu.php';
include 'bottompage.php';
print ("</body></html>");



\Ben.



0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Assisted Solution

by:Jonza
Jonza earned 244 total points
ID: 8108953
yup, that should solve your problem.
you cant use PHP inside PHP =)

also change this:
print ("<html><head><title></title><link rel=stylesheet href='css1.css' type='text/css'></head><body><center><?php include 'topbanner.php'; ?><?php include 'leftmenu.php'; ?><td valign='top'><table width='500' border='0'><?php include 'iconsnav.php'; ?><tr><td class='regulartitle'>");


to this:
print ("<html><head><title></title><link rel=stylesheet href='css1.css' type='text/css'></head><body><center>");
include 'topbanner.php';
include 'leftmenu.php';
print("<td valign='top'><table width='500' border='0'>");
include 'iconsnav.php';
print("<tr><td class='regulartitle'>");
0
 
LVL 1

Expert Comment

by:Jonza
ID: 8108962
oh.. and the include statements..
use them like this:
include("topbanner.php");
instead of this:
include "topbanner.php";  //may be the problem on some servers

make these corrections that i gave to your script and the one that bcouldrey gave to make your script work :)
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 8111355
Another interpretation of all of the above.

Note the use of the heredoc code (<<<), this can assist in making your ' and " usage a LOT easier!!!

<html>
<head>
<title></title>
<link rel="stylesheet" href="css1.css" type="text/css">
</head>
<body>
<center>
<?php
$iconnumbertwo = $iconnumber - 1;

include ('topbanner.php');
include ('leftmenu.php');

echo<<<END_HTML
<td valign="top">
<table width="500" border="0">

END_HTML;

include ('iconsnav.php');

echo<<<END_HTML
<tr><td class="regulartitle">Icons: {$bandname} [{$iconnumber}]</td><tr><td class="newstbl">
END_HTML;

while ($iconnumber > 0)
     {
     $iconnumbertwo = $iconnumbertwo - 1;
     echo<<<END_HTML
<a href="aim:BuddyIcon?src=http://www.punkaim.com/theicons/{$abrev}{$iconnumertwo}.gif"><img src="http://www.punkaim.com/theicons/{$abrev}{$iconnumertwo}.gif" border="0"></a>
END_HTML;
     }

echo<<<END_HTML
</td></td></tr></table></td>
END_HTML;

include ('rightmenu.php');
include ('bottompage.php');

?>
</body>
</html>

Regards,

Richard.
0
 
LVL 40

Assisted Solution

by:Richard Quadling
Richard Quadling earned 244 total points
ID: 8111375
And watch out for the spelling mistake of $iconnumertwo in the <a> tag. Sorry.

Oh. Just noticed you mispelled them too! Ha!

Richard.

<html>
<head>
<title></title>
<link rel="stylesheet" href="css1.css" type="text/css">
</head>
<body>
<center>
<?php
$iconnumbertwo = $iconnumber - 1;

include ('topbanner.php');
include ('leftmenu.php');

echo<<<END_HTML
<td valign="top">
<table width="500" border="0">

END_HTML;

include ('iconsnav.php');

echo<<<END_HTML
<tr><td class="regulartitle">Icons: {$bandname} [{$iconnumber}]</td><tr><td class="newstbl">
END_HTML;

while ($iconnumber > 0)
     {
     $iconnumbertwo = $iconnumbertwo - 1;
     echo<<<END_HTML
<a href="aim:BuddyIcon?src=http://www.punkaim.com/theicons/{$abrev}{$iconnumbertwo}.gif"><img src="http://www.punkaim.com/theicons/{$abrev}{$iconnumbertwo}.gif" border="0"></a>
END_HTML;
     }

echo<<<END_HTML
</td></td></tr></table></td>
END_HTML;

include ('rightmenu.php');
include ('bottompage.php');

?>
</body>
</html>
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 11387200
Abandoned! Abandoned!!! After all this excellent work!!!! Jees! You'd think we would get an award of SOMETHING!!!! <grin> "I'd just like to thank my mum and my dad and my cats and the nextdoor neighbour's goldfish salesmen's car washer for all their help and inspiration! <blub> I never <blub> expected <blub> <blub> ..." (Led away in tears! Ed.)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question