Forum Moderators: coopster

Message Too Old, No Replies

Nesting PHP

         

tahu forever

11:07 pm on Apr 20, 2003 (gmt 0)

10+ Year Member



I have this script and the problem is that i am unsure how to nest line six of the code where I want to include count.php. I get no output at all.

<?php
if( isset( $HTTP_COOKIE["CookieName"] ))
{
echo "<font class=header>Private Messages
<br><IMG height=10 src=images/line.gif width=100% border=0></font>
<?php include ('count.php');?>
</td></tr>";
}
else
{
echo "<font class=header>New Players
<br><IMG height=10 src=images/line.gif width=100% border=0></font>
The Bloomfield Junior Rugby League has held its sign-on day for 2003, <a href=new.php>click here.</a><br>
</td></tr>";
}

?>

hpche

11:33 pm on Apr 20, 2003 (gmt 0)

10+ Year Member



If you change

echo "<font class=header>Private Messages
<br><IMG height=10 src=images/line.gif width=100% border=0></font>
<?php include ('count.php');?>
</td></tr>";

to

echo "<font class=header>Private Messages
<br><IMG height=10 src=images/line.gif width=100% border=0></font> ";
include ('count.php');
echo "</td></tr>";

then it should work I think.

willybfriendly

11:38 pm on Apr 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't understand why you want to nest as you have in this code snippet. Why not just:

<?php
if( isset( $HTTP_COOKIE["CookieName"] ))
{
echo "<font class=header>Private Messages
<br><IMG height=10 src=images/line.gif width=100% border=0></font>;
include ('count.php');
...?>

Or, add the first echo statement to 'count.php', and do:

if( isset( $HTTP_COOKIE["CookieName"] ))
include('count.php');
else
echo...

WBF

<edit>Whoops, HPCHE, you were responding even as I was<edit>