Dear Gary $_SESSION variable would be available only if you have session_start() at the top of the page. For $_POST, i presume u hve method POST defined for the form element ============ regds amit "The difference between fiction and reality? Fiction has to make sense." On Mon, Feb 21, 2011 at 10:39 PM, Gary <gpaul@xxxxxxxxxxxxxxxx> wrote: > I have a 3 step form that calls the data from a mysql DB. First is a > dropdown to select a state, which then brings up a dynamically created > check > list of the counties in that state, so far all works well. I am unable to > get the checkbox choices to appear on the third page. > > If someone could take a look at this and tell me where I am going wrong. > > This is the code for the page that creates the checkboxes. There are some > extra lines in there where I was trying to get it to work. Again this works > fine, but my guess is that see this may shed light. > > <?php > $county1=$_SESSION['county$i']; > $counties=$_SESSION['counties']; > $row_name=$_SESSION['name'] = $row[name]; > $count_choice=$_SESSION['name']; > $result1=$_SESSION['$result']; > $choice=$_POST['state']; > if ( isset($_POST['submit']) ) { // if form is submitted, process it > > 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"; > > /*$link = mysql_connect("", "", ""); > mysql_select_db("");*/ > $result = mysql_query("SELECT * FROM `counties` WHERE state_id = > '$choice'") > or die(mysql_error()); > > if ($result) { > print "<table width=200 border=1>\n"; > > print "<th> </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($result) ) { > $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"; > } > > > This is the page that I am unable to get to call the checkbox selections > > <?php > $count_choice1=$_SESSION['county$i']; > $count_choice2=$POST['counties']; > $count_choice3=$_POST['name']; > $result1=$_SESSION['$result']; > /*$count_choice=$_SESSION['name']; */ > $count_choice=$_POST['county$i']; > $choice=$_SESSION['name']; > $_POST["county$i"]; > > > $result = mysql_query("SELECT * FROM `counties` WHERE name = '$choice'") or > die(mysql_error()); > /*$query = mysql_query("SELECT * FROM counties "); > $result = mysql_query($query) or die ("Error in query: $query. > ".mysql_error());; > echo $row['name']; > echo "$query";*/ > while($row = mysql_fetch_array($result)) > { > echo $row['name']; > /*"{$row['name']}<br>" ;*/ > > > } > echo "$choice"; > /*echo $_SESSION['county$i']; > echo $_SESSION['counties']; > echo $_SESSION['name']; > echo "$count_choice"; > echo "$row['name']"; > echo "$county$1"; > echo "$counties"; > echo "$row_name"; */ > ?> > -- > > Any Suggestions? > > Thank you. > > > Gary > > > > __________ Information from ESET Smart Security, version of virus signature > database 5893 (20110221) __________ > > The message was checked by ESET Smart Security. > > http://www.eset.com > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >