I have a script that is going into semi-production and during this
process a new problem was uncovered. I have the table a couple of table
fields setup as "Not NULL" with a "Default" value. The problem is that if
the user fails to select anything I get garbage in one of the fields and
nothing in the other. I think this might be due to the PHP variable
grabbing something, but I am not sure what. Here is the pertinent code.
{ Code snippet }
$a = 0;
$accnts = array();
$shells = array();
$grps = array();
$others = array();
mysql_select_db($database, $Prod);
$shell_list = getEnumOptions('accounts','shell');
$shell_tmp = "<select size=\"1\" name=\"shell[]\">\n";
$shell_tmp .= "<option>Default Shell</option>\n";
foreach ($shell_list as $item) {
$shell_tmp .= "<option>$item</option>\n";
}
$shell_tmp .= "</select>\n";
$query_groups = "SELECT name FROM grps";
$groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error());
$grp_list = "<select size=\"1\" name=\"grp[]\">\n";
$grp_list .= "<option>Primary Group</option>\n";
$grp_list .= "<option>-----------</option>\n";
while($name = mysql_fetch_row($groups_tmp)) {
$grp_list .= "<option>$name[0]</option>\n";
}
$grp_list .= "</select>\n";
{ Code snippet }
<form name="form1" method="post" action="account_final.php">
<?php
while (isset($_POST['system'][$a])) {
echo "<td width=\"20%\"><div align=\"center\"><font
color=\"99CCCC\">".$_POST['system'][$a]."</font></div></td>";
echo "<td width=\"20%\"><div
align=\"center\">".$shell_tmp."</div></td>";
echo "<td width=\"20%\"><div
align=\"center\">".$grp_list."</div></td>";
echo "<td width=\"20%\"><div align=\"center\"><input type=\"text\"
name=\"other[]\" value=\"\" size=\"15\"></div></td></tr>";
$tmp = $sbcuid."-".$_POST['system'][$a];
$a++;
array_push( $accnts, $tmp );
}
?>
Thanks in advance for any help.
Scott Nipp
Phone: (214) 858-1289
E-mail: [EMAIL PROTECTED]
Web: http:\\ldsa.sbcld.sbc.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php