I have been trying to do construct a form that lists comments submitted by users in an FAQ application.
I constructed this big huge program that would have worked, but I have hit a snag.
Everytime I thought it was the logic in my code that was giving me fits, I stripped the code down further and further to test it.
Well here is what I found-
This form is not sending variables!!!!
As a test, I assigned the variable $something the value "WOW", when you submit the form, it does not print the value in $something, it prints nothing 🙁
Can someone look at this code and tell me where I am going wrong?:
<?php
INCLUDE("../valuesquidproquo185.php");
INCLUDE("../header2.php");
#########################################
## This will MODERATE PENDING COMMENTS ##
#########################################
#########################
## Connect to Database ##
#########################
$Link1 = mysql_connect($Host, $User, $Password);
mysql_select_db($DBName4, $Link1);
#############################################
## Get Variables For the Moderator Display ##
#############################################
$Query = "SELECT comment_id, username, pro_comment, pro_link, date_submitted from $TableName302 WHERE pro_block = '3'";
$Result = mysql_query($Query, $Link1);
$Count = mysql_num_rows($Result);
##########################
## DISPLAY THE COMMENTS ##
##########################
IF(isset($Submit)) {
Print ("$something");
}ELSE{
$something = "wow";
PRINT ("
<p align='center'><font color='#FF0000' size='6'><b><u>MODERATE COMMENTS</u></b></font></p>
<b># of Comments to be Moderated: $Count</b><br>
<form method='post' action='$PHPSELF'>
<table width='100%' border='1'>
<tr>
<td width='5%'>YES</td>
<td width='5%'>NO</td>
<td width='5%'>HOLD</td>
<td width='20%'>USER</td>
<td width='55%'>COMMENT</td>
<td width='10%'>See Link?</td>
</tr>");
WHILE ($row = mysql_fetch_array($Result)) {
PRINT ("
<tr>
<td width='5%'>
<input type='radio' name='status$row[comment_id]' value='2'>
</td>
<td width='5%'>
<input type='radio' name='status$row[comment_id]' value='1'>
</td>
<td width='5%'>
<input type='radio' name='status$row[comment_id]' value='3'>
</td>
<td width='20%'>$row[username]</td>
<td width='55%'>$row[pro_comment]</td>
<td width='10%'><a href ='$row[pro_link]'>YES</a></td>
</tr>
");
}
PRINT("
</table>
<p align='center'>
<input type='submit' name='Submit' value='SUBMIT THIS MODERATED LIST'>
</p>
</form>
");
}
INCLUDE("../footer2.php");
?>
Any help would be appreciated 🙂