Hello fellow members.
I am having a bit of a issue with my forum edit.
Here is the code to give you an idea:
<?php
if(!$_SESSION['uid']){
header("Location: index.php");
}
$action = $_GET['act2'];
$actions = array('reply','topic','admin');
if($action){
$admin = isa($_SESSION['uid']);
if($action == 'admin'){
if($admin){
//
}else {
echo "You are not allowed to view this page!";
}
}
if($action == 'reply'){
$id = mss($_GET['id']);
if($id){
$sql = "SELECT * FROM `forum_replies` WHERE `id`='".$id."'";
$res = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($res) == 0){
echo "This topic does not exist, therefore you cannot edit it!";
}else {
$row = mysql_fetch_assoc($res);
$user_id = $row['uid'];
if($user_id == $_SESSION['uid'] || $admin == 1){
if(!$_POST['submit']){
echo "<form method=\"post\" action=\"index.php?act=mod&act2=reply&id=".$id."\">\n";
echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n";
echo "<tr><td class=\"forum_header\"><textarea style=\"width:90%\" name=\"reply\">".$row['message']."</textarea></td></tr>\n";
echo "<tr><td class=\"forum_header\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Edit This Reply\"></td></tr>\n";
echo "</table></form>\n";
}
}else {
echo "This is not your reply to edit!";
}
}
}
}
if($action == 'topic'){
//
}
}else {
header("Location: index.php");
}
?>
The issue I am having is that this part of the code just wouldn't display the form and table:
if($user_id == $_SESSION['uid'] || $admin == 1){
if(!$_POST['submit']){
echo "<form method=\"post\" action=\"index.php?act=mod&act2=reply&id=".$id."\">\n";
echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n";
echo "<tr><td class=\"forum_header\"><textarea style=\"width:90%\" name=\"reply\">".$row['message']."</textarea></td></tr>\n";
echo "<tr><td class=\"forum_header\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Edit This Reply\"></td></tr>\n";
echo "</table></form>\n";
}
Basically when the user clicks on the Edit topic link, which is present on the topic.php page(code):
echo topic($rowr['message']);
$adminz = isa($_SESSION['uid']);
if($adminz == 1 || $rowr['uid'] == $_SESSION['uid']){
echo "<tr><td align=\"left\" colspan=\"2\"><a href=\"./index.php?act=mod&act2=reply&id=".$rowr['id']."\">Edit This Reply</a></td></tr>\n";
}
it then takes the user to the modifying page and should display a form/table.
The above code works as once clicked on the link the it goes to the next page but is BLANK
Thanks