Dynamically Created Checkboxes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a script that was working, however I discovered it was only working 
in IE7, not in FF or Chrome. It also has stopped working in IE7 once I put 
it on the remote server.  It is to create checkboxes from data called from 
the db. I have echo'd the mysql_num_row and am getting a result, so the 
query seems to be working.  At this point I get a blank page.  Can someone 
point me in the right direction to get this working (again).

$choice=$_POST['state'];
mysql_select_db($database_assess, $assess_remote);
$query_Recordset1 = ("SELECT * FROM `counties` WHERE state_id = 
'$choice'")or die(mysql_error());
$Recordset1 = mysql_query($query_Recordset1, $assess_remote) or 
die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
   <?php
echo "$totalRows_Recordset1";
echo "$row_Recordset1";
if ( isset($_POST['submit']) ) { // if form is submitted, process it



/////////////////////////////////////////I believe my issue is 
below\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

for($i=1; $i<=$_POST['counties']; $i++) {
if ( isset($_POST["county{$i}"] ) ) {
print $_POST["county{$i}"]." is checked.<br/>";
}
}

} else { // if form isn't submitted, output the form
$county_choice=$_SESSION['county{$1}'];
print "<form action=\"phpForm3.php\" method=\"POST\">\n";

if ($Recordset1) {
print "<table width=200 border=1>\n";

print "<th>&nbsp; </th>\n";
print "<th> State </th>\n"; //2 fields in Counties table, State and County
print "<th> County </th>\n";

print "</tr>\n";
//create table
$i = 0;
while ( $row = mysql_fetch_array($Recordset1) ) {
$i++;
print "<tr>\n";

print "<td><input type=\"checkbox\" name=\"county$i\" 
value=\"$row[name]\"></td>\n";

echo "<td>{$row['state_id']}</td>\n";

echo "<td>{$row['name']}</td>\n";

echo "</tr>\n";

}//end while
print "</table>\n";
} else {
echo("<P>Error performing query: " .
mysql_error() . "</P>");

}
print "<input type=\"hidden\" name=\"counties\" value=\"$i\"/>\n";
print "<input type=\"submit\" name=\"submit\" value=\"Go\"/>\n";
}

?>

Would appriciate your help.

Thank you.
-- 
Gary 



__________ Information from ESET Smart Security, version of virus signature database 5897 (20110222) __________

The message was checked by ESET Smart Security.

http://www.eset.com





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux