Making all actions work with in one index.php
Posted: Wed Jul 07, 2004 6:02 am
I am very new at php and I am developing a testimonials page. I am tring to get the admin site to work with just one show.php. As of now I have been able to get a three funtions to work with in the show.php. With the help of this forum. The final two actions are totally different in the way they will be called.
Here is the code, I have mark where my menu starts:
I am wanting the show.php to display some kind of welcome on the first visit to the show.php page. Kind of like what I have here http://www.lsscripts.com/projects/testi ... /index.php
Then the add.php is also what I would like to have work with in the admi site. You can see it here http://www.lsscripts.com/projects/testi ... in/add.php
Now this add.php is defferent from the clients side. This will only be used my the admin.
Hope you understand what I am getting at. Thanks in advance on any advice.
Here is the code, I have mark where my menu starts:
Code: Select all
<?
$status = (!empty($_GET['status']) ? $_GET['status'] : '%');
include "../inc/config.php";
switch($action) {
case "approve":
db();
mysql_query("UPDATE ls_testimonials SET approved='y' WHERE id=$id");
$pagecontent.="Item {$id} Approved<br><br>";
db_close();
break;
case "hold":
db();
mysql_query("UPDATE ls_testimonials SET approved='h' WHERE id=$id");
$pagecontent.="Item {$id} On Hold<br><br>";
db_close();
break;
case "delete":
db();
mysql_query("DELETE FROM ls_testimonials WHERE id=$id");
$pagecontent.="Item {$id} Deleted<br><br>";
db_close();
break;
default:
break;
}
db();
$query = "SELECT * FROM ls_testimonials WHERE approved LIKE '$status'";
$formdata_res=mysql_query($query) or die("query failed: " . mysql_error());
$pagecontent.="<table width=760 border=0 cellspacing=2 cellpadding=0>";
$pagecontent.="<tr>";
/*HERE IS WHERE MY MENU STARTS*/ $pagecontent.="<td width=150 valign=top><table width=150 background=../inc/skins/default/images/menu_bg.gif>
<tr><td><font size=2><b>Menu</b></font></td></tr>
<tr><td><font size=2><a href=show.php?status=add.php>Add Testimonials</a></font></td></tr>
<tr><td><font size=2><a href=show.php?status=n>New Testimonials</a></font></td></tr>
<tr><td><font size=2><a href=show.php?status=h>On Hold Testimonials</a></font></td></tr>
<tr><td><font size=2><a href=show.php?status=y>Active Testimonials</a></font></td></tr>
</table></td>";
$pagecontent.="<td width=610 valign=top><table width=100% border=0 cellpadding=0 cellspacing=1 ";
while ($formdata=mysql_fetch_object($formdata_res)) {
$link_display=htmlentities($formdata->link_display);
$email=htmlentities($formdata->email);
$company=htmlentities($formdata->company);
$testimonials=htmlentities($formdata->testimonials);
$pagecontent.="<tr>
<td width=203 bgcolor=#F1F1F1><font size=2><b>Display:</b></font></td>
<td width=203 bgcolor=#F1F1F1><font size=2><b>Email:</b></font></td>
<td width=203 bgcolor=#F1F1F1><font size=2><b>Website:</b></font></td></tr>
<td width=203 bgcolor=#E9EDF0><font size=2>{$link_display}</font></td>
<td width=203 bgcolor=#E9EDF0><font size=2><a href='mailto:{$email}'>{$email}</a></font></td>
<td width=203 bgcolor=#E9EDF0><font size=2><a href='{$company}' target=new>{$company}</a></font></td></tr>
<tr><td colspan=2><font size=2><b>Testimonial:</b></font><textarea style=width=300; border: 1; rows=1>{$testimonials}</textarea></td>
<td><center><a href='?id={$formdata->id}&action=approve'><img src=../inc/skins/default/images/approve.gif width=17 height=17 border=0 ALT=Approve></a>
<a href='?id={$formdata->id}&action=hold'><img src=../inc/skins/default/images/hold.gif width=17 height=17 border=0 ALT=Hold></a>
<a href='?id={$formdata->id}&action=delete'><img src=../inc/skins/default/images/delete.gif width=17 height=17 border=0 ALT=Delete></a> </center></td>
</tr>";
}
$pagecontent.="</table></td>";
$pagecontent.="</tr>";
$pagecontent.="</table>";
db_close();
?>Then the add.php is also what I would like to have work with in the admi site. You can see it here http://www.lsscripts.com/projects/testi ... in/add.php
Now this add.php is defferent from the clients side. This will only be used my the admin.
Hope you understand what I am getting at. Thanks in advance on any advice.