TheVDM
04-22-2009, 07:36 AM
Sorry that the title isn't very descriptive, I am creating a basic CMS script for no reason other than improving my php sql skills. (based from this - http://www.weberdev.com/get_example-4392.html)
In the backend I have a script that shows the current web pages saved in the database, each row has an option to delete or update.
I would like to remove the delete checkbox for the first instance only (page id 1) as this is the home page and the index script is set to load this if there is no page id in the url
Here is my code
<table width="775" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><hr size="1" noshade></td>
</tr>
<tr>
<td>
<form action="" method="post" name="" id="">
<table width="600" border="1" align="center" cellpadding="2" cellspacing="2">
<tr>
<td><input name="topcheckbox" type="checkbox" class="check" id="topcheckbox" onClick="selectall();" value="ON">
Select All </td>
<td colspan="3" align="center"><a href="form.php?mode=add">Add a new page </a></td>
</tr>
<tr>
<td><strong><a href="javascript:goDel()">Delete</a></strong></td>
<td><strong>Page Title</strong></td>
<td><strong>Link Text </strong></td>
<td><strong>Update</strong></td>
</tr>
<?
include("../includes/conect.php");
$sql="select sn,pagename,linktext from $content order by sn";
$result=mysql_query($sql,$connection) or die(mysql_error());
while($row=mysql_fetch_array($result)) {
?>
<tr>
<td><input name="<? echo $row['sn']; ?>" type="checkbox" class="check"></td>
<td><? echo $row['pagename']; ?></td>
<td><? echo $row['linktext']; ?></td>
<td><a href="<? echo "form.php?sn=".$row['sn']."&mode=update"; ?>">Update</a></td>
</tr>
<? } ?>
<tr>
<td><strong><a href="javascript:goDel()">Delete</a></strong></td>
<td><strong>Page Title </strong></td>
<td><strong>Link Text</strong></td>
<td><strong>Update</strong></td>
</tr>
</table>
</form></td>
</tr>
</table>
Regards
Jim
In the backend I have a script that shows the current web pages saved in the database, each row has an option to delete or update.
I would like to remove the delete checkbox for the first instance only (page id 1) as this is the home page and the index script is set to load this if there is no page id in the url
Here is my code
<table width="775" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td><hr size="1" noshade></td>
</tr>
<tr>
<td>
<form action="" method="post" name="" id="">
<table width="600" border="1" align="center" cellpadding="2" cellspacing="2">
<tr>
<td><input name="topcheckbox" type="checkbox" class="check" id="topcheckbox" onClick="selectall();" value="ON">
Select All </td>
<td colspan="3" align="center"><a href="form.php?mode=add">Add a new page </a></td>
</tr>
<tr>
<td><strong><a href="javascript:goDel()">Delete</a></strong></td>
<td><strong>Page Title</strong></td>
<td><strong>Link Text </strong></td>
<td><strong>Update</strong></td>
</tr>
<?
include("../includes/conect.php");
$sql="select sn,pagename,linktext from $content order by sn";
$result=mysql_query($sql,$connection) or die(mysql_error());
while($row=mysql_fetch_array($result)) {
?>
<tr>
<td><input name="<? echo $row['sn']; ?>" type="checkbox" class="check"></td>
<td><? echo $row['pagename']; ?></td>
<td><? echo $row['linktext']; ?></td>
<td><a href="<? echo "form.php?sn=".$row['sn']."&mode=update"; ?>">Update</a></td>
</tr>
<? } ?>
<tr>
<td><strong><a href="javascript:goDel()">Delete</a></strong></td>
<td><strong>Page Title </strong></td>
<td><strong>Link Text</strong></td>
<td><strong>Update</strong></td>
</tr>
</table>
</form></td>
</tr>
</table>
Regards
Jim