View previous topic :: View next topic |
Author |
Message |
mjjk91 -
Joined: 03 Feb 2004 Posts: 75 Location: Australia
|
Posted: Wed May 26, 2004 7:35 am Post subject: Simple Question - Simple Answer??? |
|
|
G'Day All,
This could well be the easiest question ever, but it is giving me no end of problems, as i have tried SOOOOOOO many combinations. This code is straightout of a textbook, and everytime i try to run it, im getting an Error 200 message, which i know is because of a syntax error in my code. Im having problems closing the IF statement. As you can see, i need to close the IF statement at the end, but am not sure how. It shows:
<?
}
But this has proven to be incorrect. I would have thought it was:
<?php
}
?>
But when i try this, it is also incorrect. I know the rest of the code works, so how do i close the IF statement at the end? Here is the entire script:
-------------------------------------------------------------------------------------
<?php
if($_SESSION['admin_access'] == true){
?>
<table width="160" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#000066">
<td width="5" height="10"><font color="#FFFFFF"> </font></td>
<td width="150"><div align="center"><font color="#FFFFFF" size"2"
face="Verdana, Arial, Helvetica, sans-serif"><strong>Admin
Links</strong></font></div></td>
<td width="5"> </td>
</tr>
<tr>
<td height="5"> </td>
<td align="left" valign="top">
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<a href="/admin/newscategory.php">Create News Article
Categories</a></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> <a
href="/admin/mod_news_category.php">Modify/Delete
News Article Categories</a></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a
href="/admin/news_insert.php">Add
News Article</a></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a
href="/admin/mod_news_article.php">Modify/Delete
News Article</a></font></p>
<p> </p>
</td>
<td> </td>
</tr>
</table>
<hr size="1">
<?
}
-------------------------------------------------------------------------------------
Cheers Everyone.
Mick Koch |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Wed May 26, 2004 1:22 pm Post subject: |
|
|
The closing php tag cannot be used before the if statement is executed . Therefore the html must be between { and }.
example:
<?
if(statement)
{
echo '<html>';
}
?>
<?php
if($_SESSION['admin_access'] == true){
echo'<table width="160" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#000066">
<td width="5" height="10"><font color="#FFFFFF"> </font></td>
<td width="150"><div align="center"><font color="#FFFFFF" size"2"
face="Verdana, Arial, Helvetica, sans-serif"><strong>Admin
Links</strong></font></div></td>
<td width="5"> </td>
</tr>
<tr>
<td height="5"> </td>
<td align="left" valign="top">
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<a href="/admin/newscategory.php">Create News Article
Categories</a></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> <a
href="/admin/mod_news_category.php">Modify/Delete
News Article Categories</a></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a
href="/admin/news_insert.php">Add
News Article</a></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a
href="/admin/mod_news_article.php">Modify/Delete
News Article</a></font></p>
<p> </p>
</td>
<td> </td>
</tr>
</table>
<hr size="1">';
}
?> |
|
Back to top |
|
 |
Motionmaster -
Joined: 21 Mar 2003 Posts: 5
|
Posted: Thu May 27, 2004 2:30 pm Post subject: |
|
|
Well, it is possible.
<? if(() == true) { ?>
<html>
<? } ?>
Must work. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|