I have a problem with a form that is being filled in from a database, and then modifying that database when the administrator submits it. The form worked fine when I used just one table from mysql, and it filled in fine when I used two tables. Now, when I try to get the POST from the other table, it just comes up blank.
This is the code I have to fill in the table:
<? session_start();
include 'db.php';
// Rights 1
if ($_SESSION['rank']=='BujiBear Creator')
{
$result = mysql_query( "SELECT DISTINCT s.user_name, email, active, r.rank FROM users s, user_rank r WHERE s.user_name = r.user_name" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width='100%' border=1>\n";
print "<tr><td> </td><td>User Name</td><td>E-Mail</td><td>Active</td><td>Rank</td></tr>";
while ($get_info = mysql_fetch_row($result)){
print "<tr><td><form action='edit_user.php' method='POST'>
<input type='submit' name='Submit' value='Submit'>
<input type='radio' name='option' value='edit'>Edit
<input type='radio' name='option' value='delete'>Delete
</td>\n";
//foreach ($get_info as $field)
print "\t<td width=35><input name='user_name' type='text' id='user_name' value='$get_info[0]'></td>\n";
print "\t<td width=75><input name='email' type='text' id='email' value='$get_info[1]'></td>\n";
print "\t<td><input name='active' type='text' id='active' value='$get_info[2]'></td></form>\n";
print "\t<td><input name='erank' type='text' id='erank' value='$get_info[3]'></td></form>\n";
print "</tr>\n";
}
print "</table>\n";
}
And here is the processed information from that form:
<? session_start();
include 'db.php';
$euser="$POST[user_name]";
$eemail="$POST[email]";
$eactive="$POST[active]";
$erank="$POST[erank]";
$option="$_POST[option]";
// IF EDITTING USER
if ($option =='edit'){
$sql_check=mysql_query("SELECT s.user_name, email, active, r.rank FROM users s, user_rank r WHERE s.user_name = r.user_name AND s.user_name='$euser'");
$sql_rows=mysql_num_rows($sql_check);
$get_info = mysql_fetch_row($sql_check);
echo "$erank ... $get_info[3]";
I have more after that but my echo statement will show what the database has with $get_info[3] but it comes up blank for my $erank. Any ideas?