Session Variables not working for checkboxes

Hi,

I've been struggling and getting great help here on how to use session variable to re-populate textares and input areas and it is working beautifully.

However, I have a routine where I build a series of checkboxes dynamically based upon some table values and the logic to re-populate these nasties is not working correctly.  The code is attached.   Can someone please tell me how to handle this situation?  Thanks very much!

Andy
<?php 
session_start();
if(!session_is_registered(myusername))
   {
   header("location:CIIdeasFormMainLogin.php");
   }
//ini_set('display_errors', 1);
//error_reporting(E_ALL);
$signon=$_SESSION['myusername'];
$password=$_SESSION['mypassword'];
$initiator = $_POST["initiator"];
$teamname = $_POST["teamname"];
$formdate = $_POST["formdate"];
$ideanumber = $_POST["ideanumber"];
$mansource = $_POST["mansource"];
$ideamission = $_POST["ideamission"];
$affected = $_POST["affected"];
$impidea = $_POST["impidea"];
$currsit = $_POST["currsit"];
$newidea = $_POST["newidea"];
$jointype = $_POST["jointype"];
$factors = $_POST["factors"];
 
if (!isset($_POST['search']) or isset($_POST['clear']))
{ // if page is not submitted to itself echo the form
  if (isset($_POST['clear']))
  {
  $_SESSION['formdate'] = "";
  $_SESSION['teamname'] = "";
  $_SESSION['ideanumber'] = "";
  $_SESSION['initiator'] = "";
  $_SESSION['mansource'] = "";
  $_SESSION['ideamission'] = "";
  $_SESSION['affected'] = "";
  $_SESSION['impidea'] = "";
  $_SESSION['currsit'] = "";
  $_SESSION['newidea'] = "";
  $_SESSION['jointype'] = "";
  $_SESSION['factors'] = "";
  }  // end of if (isset($_POST['clear']))
?>
<html>
<head><title>Continuous Improvement Ideas Form</title>
<img src="c.jpg" align=left hspace=0><img src="c.jpg" align=right hspace=0><br><br><P style="font-size: 24pt; color: green" align="center"><b>Continuous Improvement Ideas</b>
<style>
 body
 {
 background: <?php echo '#FFFF99';?>;
 }
</style>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 
<hr noshade color=black>
<p style="text-align: center;"><font size=2><b>
COMPLETED FORMS ARE PROCESSED BY THE CONTINUOUS IMPROVEMENT GROUP
</font></b></p>
<hr size=4 noshade color=black>
 
<font size=4 color=red><b> 1) &nbsp;Mission Statement Section</b></font><br>
<font size=2 color=red><i>This section should outline the mission and goal of the idea.</i></font>
 
<table border=2 bordercolor=black >
 <tr>
  <td>
   <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
   <font size=4 color=green><b>Date:&nbsp;
   <font size=4 color=black><b>
   <input type="text" size="21" maxlength="20" name="formdate" value="<?php echo $_SESSION['formdate']; ?>">
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></b>
   <font size=4 color=green><b>&nbsp;&nbsp;&nbsp;&nbsp;Idea#:&nbsp;</font><font color=black></b>
   <input type="text" size="15" maxlength="14" name="ideanumber" value="<?php echo $_SESSION['ideanumber']; ?>">
   </font><br>
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <font size=1 color=green>Ex.&nbsp;&nbsp;&nbsp;</font><font size=1 color=red> GT '25-JAN-2008' and</font>
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <font size=1 color=green>Ex.&nbsp;&nbsp;&nbsp;</font><font size=1 color=red> LT '1004' or</font>
 
 
   <br><br>
   <font size=4 color=green><b>Inintiator:&nbsp;&nbsp;</font></b>
   <input type="text" size="64" maxlength="64" name="initiator" value="<?php echo $_SESSION['initiator']; ?>"><br>
 
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <font size=1 color=green>Ex.&nbsp;&nbsp;&nbsp;</font><font size=1 color=red> contains 'johnson'</font>
   &nbsp;&nbsp;&nbsp;&nbsp;<font size=1 color=green>Ex.&nbsp;&nbsp;&nbsp;</font><font size=1 color=red> = 'Bill Johnson'</font>
   &nbsp;&nbsp;&nbsp;&nbsp;<font size=1 color=green>Note: '<font size=1 color=red>contains<font size=1 color=green>' is not case-sensitive,  '</font>
   <font size=1 color=red>= <font size=1 color=green>' is case-sensitive.
 
 
   <br><br>
   <font size=4 color=green><b>Manufacturing Source:</font><font size=3> (Choose one, if applicable)</font></b><br />
   <font color=#990099 size=4 >Forks I:</font><input type="radio" value="Forks I" name="mansource" <?php if ($_SESSION['mansource'] == "Forks I") { echo "checked=\"checked\""; } ?>> &nbsp;&nbsp;&nbsp;&nbsp;
   <font color=#990099 size=4 >Forks II:<input type="radio" value="Forks II" name="mansource" <?php if ($_SESSION['mansource'] == "Forks II") { echo "checked=\"checked\""; } ?>>&nbsp;&nbsp;&nbsp;&nbsp;
   <font color=#990099 size=4 >LVIP:<input type="radio" value="LVIP" name="mansource" <?php if ($_SESSION['mansource'] == "LVIP") { echo "checked=\"checked\""; } ?>>&nbsp;&nbsp;&nbsp;&nbsp;
   <font color=#990099 size=4 >Distribution:<input type="radio" value="Distribution" name="mansource" <?php if ($_SESSION['mansource'] == "Distribution") { echo "checked=\"checked\""; }?>>&nbsp;&nbsp;&nbsp;&nbsp;
   <font color=#990099 size=4 >Other:<input type="radio" value="Other" name="mansource" <?php if ($_SESSION['mansource'] == "Other") { echo "checked=\"checked\""; } ?>>&nbsp;&nbsp;&nbsp;&nbsp;
   <br />
   <br>
   <font size=4 color=green><b>Idea Mission/Goal:</font></b><br />
   <textarea rows="5" cols="105" name="ideamission" wrap="soft"><?php echo $_SESSION['ideamission']; ?></textarea><br /> 
 
   &nbsp;<font size=1 color=green>Ex.&nbsp;&nbsp;&nbsp;</font><font size=1 color=red> contains 'crayon'</font>
   &nbsp;&nbsp;&nbsp;&nbsp;<font size=1 color=green>Note: '<font size=1 color=red>contains<font size=1 color=green>' is not case-sensitive,  '</font>
   <font size=1 color=red>= <font size=1 color=green>' is case-sensitive.
 
   <br><br><br>
   <font size=4 color=green><b>Product or Line Affected:&nbsp;</font></b><font size=2 color=green><i>
   (What specific product or production line will be affected by the CI event?)</font></i><br />
   <textarea rows="2" cols="105" name="affected" wrap="soft"><?php echo $_SESSION['affected']; ?></textarea><br /> 
 
   <br>&nbsp;<font size=1 color=green>Ex.&nbsp;&nbsp;&nbsp;</font><font size=1 color=red> contains 'crayon'</font>
   &nbsp;&nbsp;&nbsp;&nbsp;<font size=1 color=green>Ex.&nbsp;&nbsp;&nbsp;</font><font size=1 color=red> = '24-count crayons'</font>
   &nbsp;&nbsp;&nbsp;&nbsp;<font size=1 color=green>Note: '<font size=1 color=red>contains<font size=1 color=green>' is not case-sensitive,  '</font>
   <font size=1 color=red>= <font size=1 color=green>' is case-sensitive.
 
   <br><br><br>
   <font size=4 color=green><b>Improvement Idea:</font></b><br />
   <textarea rows="5" cols="105" name="impidea" wrap="soft"><?php echo $_SESSION['impidea']; ?></textarea><br /> 
 
   <br>&nbsp;<font size=1 color=green>Ex.&nbsp;&nbsp;&nbsp;</font><font size=1 color=red> contains 'crayon'</font>
   &nbsp;&nbsp;&nbsp;&nbsp;<font size=1 color=green>Note: '<font size=1 color=red>contains<font size=1 color=green>' is not case-sensitive,  '</font>
   <font size=1 color=red>= <font size=1 color=green>' is case-sensitive.
 
   <br><br>
  </td>
 </tr>
</table>
 
<hr size=4 noshade color=black><br>
 
<font size=4 color=red><b> 2) &nbsp;Current Situation (AS IS)</b></font><br>
<font size=2 color=red><i>Fill out this section to establish a baseline to measure the improvement against.  This should be the "as-is".</i></font>
<!--<p style="text-align: left;"> -->
<br><font size=2><b>Description:</font></b> 
<!--</p> -->
<br><textarea rows="7" cols="105" name="currsit" wrap="soft"><?php echo $_SESSION['currsit']; ?></textarea>
 
<b><br>&nbsp;<font size=1 color=green>Ex.&nbsp;&nbsp;&nbsp;</font><font size=1 color=red> contains 'crayon'</font>
&nbsp;&nbsp;&nbsp;&nbsp;<font size=1 color=green>Note: '<font size=1 color=red>contains<font size=1 color=green>' is not case-sensitive,  '</font>
<font size=1 color=red>= <font size=1 color=green>' is case-sensitive.</b>
 
 
<br><br><br>
<font size=4 color=red><b> 3) &nbsp;New Ideas (SHOULD BE)</b></font>
<br><b><font color=black size=2>Description:</font></b><br>
<textarea rows="7" cols="105" name="newidea" wrap="soft"><?php echo $_SESSION['newidea']; ?></textarea><br /> 
 
<b>&nbsp;<font size=1 color=green>Ex.&nbsp;&nbsp;&nbsp;</font><font size=1 color=red> contains 'crayon'</font>
&nbsp;&nbsp;&nbsp;&nbsp;<font size=1 color=green>Note: '<font size=1 color=red>contains<font size=1 color=green>' is not case-sensitive,  '</font>
<font size=1 color=red>= <font size=1 color=green>' is case-sensitive.</b>
 
<br><br><br>
 
<font size=4 color=red><b> 4) &nbsp;Impacted Factors (Choose all that apply)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Choose join criteria for multiple <em> Impacted Factors</em> selections:</b></font><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font size=4 color=red><b>Join using '</font><font size=4 color=#990099>AND</font><font size=4 color=red>':</font><input type="radio" value="and" name="jointype" 
   <?php if ($_SESSION['jointype'] == "and") { echo "checked=\"checked\""; } ?>>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<font size=4 color=red><b>Join using '</font><font size=4 color=#990099>OR</font><font size=4 color=red>':</font><input type="radio" value="or" name="jointype" 
   <?php if ($_SESSION['jointype'] == "or") { echo "checked=\"checked\""; } ?>> 
 
<?php
$conn = OCILogon($signon, $password, 'CIDB') or die("ERROR CONNECTING - Notify Global Support");
$query = "select literal_text from ci.literal where literal_group = 'Impacted Factors' order by seq_no";
$stid = OCI_Parse($conn, $query);
$r = OCI_Execute($stid, OCI_DEFAULT);
if ($r)
   {
   echo "<table border=0>";
   while ($row = OCI_FETCH_ARRAY ($stid, OCI_ASSOC))
      {
      echo "<TR bordercolor=#ffff99>";
      foreach ($row as $item)
         {
         echo "<TD width=858><font color=#990099><input type='checkbox' value='$item' name = 'factors[]' ";
        if ($_SESSION['factors'] == $item)
            {
            echo "checked=\"checked\"";
            }
         echo ">$item</font></td>";
         }  // End of FOREACH
      echo "</tr>";
      }  // End of While
   echo "</table>";
   }
else
   {
   echo 'Unable to execute query.  Notify Global Support.';
   }  // end of IF
OCILogoff($conn);
?>
 
<hr size=4 noshade color=black><br>
 
<table>
   <tr>
      <td align=left width=40%>
      <input type="submit" value="Search" name="search">
      </td>
      <td align=right width = 60%>
      <input type="submit" value="Clear/Reset Form" name="clear"><br>
      </td>
   </tr>
   <tr>
      <td align=left width=40%>
      <font color=navy size=2>Click Here to Search Based <br>Upon Criteria Entered Above.</font>
      </td>
      <td align=right width=60%>
      <font color=navy size=2> Use This Button to <br>Clear/Reset the Form.</font>
      </td>
   </tr>
</table>
</form>
<?php
}
elseif (isset($_POST['search']))
{
 
//$formdate = str_replace("<", "", $formdate);
$formdate = str_replace("\"", "'", $formdate);
$ideanumber = str_replace("\"", "'", $ideanumber);
$initiator = str_replace("\"", "'", $initiator);
$teamname = str_replace("\"", "'", $teamname);
$ideamission = str_replace("\"", "'", $ideamission);
$affected = str_replace("\"", "'", $affected);
$impidea = str_replace("\"", "'", $impidea);
$currsit = str_replace("\"", "'", $currsit);
$newidea = str_replace("\"", "'", $newidea);
 
$querystring = "Select * from ci.idea where ";
 
// Formdate
if ($formdate > "")
{
//$s_formdate = html_entity_decode($_SESSION['formdate']);
$_SESSION['formdate']=$formdate;
$querystring = $querystring."INITIATION_DATE ".$formdate." ";
echo "querystring = ".$querystring."<br>";
}
 
// Ideanumber
if ($ideanumber > "")
{
$_SESSION['ideanumber']=$ideanumber;
$querystring = $querystring."ID ".$ideanumber." ";
echo "querystring = ".$querystring."<br>";
}
 
// Initiator
$substring = "contains";
if ($initiator > "")
   {
   //$pos=0;
   $position = strpos($initiator, $substring);
   if($position > -1)
      {
      // using contains
      $pos1 = strpos($initiator, "'");
      $pos2 = strpos($initiator, "'", $pos1+1);
      $containsvalue = substr($initiator, $pos1, ($pos2-$pos1)+1);
      $condition = substr($initiator, $pos2+1, (strlen($initiator)-$pos2));
      $_SESSION['initiator']=$initiator;
      $querystring = $querystring." CONTAINS(INITIATOR, ".$containsvalue.") > 0".$condition." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of if($position > -1)
   else
      {
      // using =
      $_SESSION['initiator']=$initiator;
      $querystring = $querystring."INITIATOR ".$initiator." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of ELSE
   }  // end of if ($initiator > "")
 
// Manufacturing Source
if ($mansource > "")
{
$_SESSION['mansource']=$mansource;
$querystring = $querystring."MANUFACTURING_SOURCE = '".$mansource."' and ";
echo "querystring = ".$querystring."<br>";
}
 
// Idea Mission/Goal
$substring = "contains";
if ($ideamission > "")
   {
   //$pos=0;
   $position = strpos($ideamission, $substring);
   if($position > -1)
      {
      // using contains
      $pos1 = strpos($ideamission, "'");
      $pos2 = strpos($ideamission, "'", $pos1+1);
      $containsvalue = substr($ideamission, $pos1, ($pos2-$pos1)+1);
      $condition = substr($ideamission, $pos2+1, (strlen($ideamission)-$pos2));
      $_SESSION['ideamission']=$ideamission;
      $querystring = $querystring." CONTAINS(MISSION_GOAL, ".$containsvalue.") > 0".$condition." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of if($position > -1)
   else
      {
      // using =
      $_SESSION['ideamission']=$ideamission;
      $querystring = $querystring."MISSION_GOAL ".$ideamission." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of ELSE
   }  // end of if ($ideamission > "")
 
// Product or Line Affected
$substring = "contains";
if ($affected > "")
   {
   //$pos=0;
   $position = strpos($affected, $substring);
   if($position > -1)
      {
      // using contains
      $pos1 = strpos($affected, "'");
      $pos2 = strpos($affected, "'", $pos1+1);
      $containsvalue = substr($affected, $pos1, ($pos2-$pos1)+1);
      $condition = substr($affected, $pos2+1, (strlen($affected)-$pos2));
      $_SESSION['affected']=$affected;
      $querystring = $querystring." CONTAINS(PRODUCT_OR_LINE, ".$containsvalue.") > 0".$condition." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of if($position > -1)
   else
      {
      // using =
      $_SESSION['affected']=$affected;
      $querystring = $querystring."PRODUCT_OR_LINE ".$affected." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of ELSE
   }  // end of if ($affected > "")
 
// Improvement Idea
$substring = "contains";
if ($impidea > "")
   {
   //$pos=0;
   $position = strpos($impidea, $substring);
   if($position > -1)
      {
      // using contains
      $pos1 = strpos($impidea, "'");
      $pos2 = strpos($impidea, "'", $pos1+1);
      $containsvalue = substr($impidea, $pos1, ($pos2-$pos1)+1);
      $condition = substr($impidea, $pos2+1, (strlen($impidea)-$pos2));
      $_SESSION['impidea']=$impidea;
      $querystring = $querystring." CONTAINS(IMPROVEMENT_IDEA, ".$containsvalue.") > 0".$condition." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of if($position > -1)
   else
      {
      // using =
      $_SESSION['impidea']=$impidea;
      $querystring = $querystring."IMPROVEMENT_IDEA ".$impidea." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of ELSE
   }  // end of if ($impidea > "")
 
// Current Situation
$substring = "contains";
if ($currsit > "")
   {
   //$pos=0;
   $position = strpos($currsit, $substring);
   if($position > -1)
      {
      // using contains
      $pos1 = strpos($currsit, "'");
      $pos2 = strpos($currsit, "'", $pos1+1);
      $containsvalue = substr($currsit, $pos1, ($pos2-$pos1)+1);
      $condition = substr($currsit, $pos2+1, (strlen($currsit)-$pos2));
      $_SESSION['currsit']=$currsit;
      $querystring = $querystring." CONTAINS(CURRENT_SITUATION, ".$containsvalue.") > 0".$condition." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of if($position > -1)
   else
      {
      // using =
      $_SESSION['currsit']=$currsit;
      $querystring = $querystring."CURRENT_SITUATION ".$currsit." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of ELSE
   }  // end of if ($currsit > "")
 
// New Idea
$substring = "contains";
if ($newidea > "")
   {
   //$pos=0;
   $position = strpos($newidea, $substring);
   if($position > -1)
      {
      // using contains
      $pos1 = strpos($newidea, "'");
      $pos2 = strpos($newidea, "'", $pos1+1);
      $containsvalue = substr($newidea, $pos1, ($pos2-$pos1)+1);
      $condition = substr($newidea, $pos2+1, (strlen($newidea)-$pos2));
      $_SESSION['newidea']=$newidea;
      $querystring = $querystring." CONTAINS(NEW_IDEA, ".$containsvalue.") > 0".$condition." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of if($position > -1)
   else
      {
      // using =
      $_SESSION['newidea']=$newidea;
      $querystring = $querystring."NEW_IDEA ".$newidea." ";
      echo "querystring = ".$querystring."<br>";
      }  // End of ELSE
   }  // end of if ($newidea > "")
 
// JoinType
 
$fcount = 0;
 
foreach ($factors as $f) 
   {
   $fstring = $fstring.", "."$f";
   $fcount = $fcount + 1;
   }  // End of FOREACH
 
$fstring = substr($fstring,1,strlen($fstring));
 
if ($jointype > "")
   {
   if ($fcount < 2)
      {
      echo "Join Type Selection "."<b><em>".$jointype."</b></em>"." Not Necessary When ".$fcount." Impacted Factor(s) Chosen.  Join Type Selection Ignored.";
      }  // End of if ($fcount < 2)
   }  // End of if ($jointype > "")
 
if ($jointype == "")
   {
   if ($fcount > 1)
      {
      echo "Join Type Selection Required When ".$fcount." Impacted Factors Chosen.  Correct and Resubmit.";
      }  // End of if ($fcount < 2)
   }  // End of if ($jointype > "")
 
$_SESSION['jointype']=$jointype;
 
// Impacted Factors
 
$_SESSION['factors']=$factors;
 
 
if ($jointype == "and")
   {
 
   }  // End of if ($jointype == "and")
elseif ($jointype == 'or')
   {
 
   }  // End of elseif ($jointype == 'or')
else
   {
 
   }  // End of Else
 
 
 
}  // End of elseif (isset($_POST['search']))
else
{
}
?> 
&#169;2008 - abcd, LLC 
<br><font color = '#FFFF99'>Created by A. B.</font>
</font>
</body>
</html>

Open in new window

LVL 2
abruskoAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
waygoodConnect With a Mentor Commented:
When dealing with forms, unchecked checkboxes are not submitted.
either assume all values are 0 before checking they are submitted

$x=0;
if(isset($_POST['x'])) $x=$_POST['x'];

OR

<input type="hidden" name="x" value="0"/>
<input type="checkbox" name="x" value="1" <?php if( (isset($_SESSION['x'])) && ($_SESSION['x']) ) echo 'Checked="checked"'; ?> />
0
 
abruskoAuthor Commented:
Got it!  Thanks!
0
 
abruskoAuthor Commented:
waygood,

I'm having trouble with the syntax you gave me withiun the context of an ECHO statement...can you help?

Here's what I have.

Thx!
Andy
<?php
$conn = OCILogon($signon, $password, 'CIDB') or die("ERROR CONNECTING - Notify Global Support");
$query = "select literal_text from ci.literal where literal_group = 'Impacted Factors' order by seq_no";
$stid = OCI_Parse($conn, $query);
$r = OCI_Execute($stid, OCI_DEFAULT);
if ($r)
   {
   echo "<table border=0>";
   while ($row = OCI_FETCH_ARRAY ($stid, OCI_ASSOC))
      {
      echo "<TR bordercolor=#ffff99>";
//      foreach ($row as $item)
//         {
//         echo "<TD width=858><font color=#990099><input type='checkbox' value='$item' name = 'factors[]' ";
//         if ($_SESSION['factors'] == $item)
//            {
//            echo "checked=\"checked\"";
//            }
//         echo ">$item</font></td>";
//         }  // End of FOREACH
      foreach ($row as $item)
         {
         echo "<input type='hidden' name = 'x' value ='0'/>";
         echo "<TD width=858><font color=#990099><input type='checkbox' name='x' value='1' <?php if( (isset($_SESSION['x'])) && ($_SESSION['x']) ) echo 'Checked='checked''; ?> />";
         if ($_SESSION['factors'] == $item)
            {
            echo "checked=\"checked\"";
            }
         echo ">$item</font></td>";
         }  // End of FOREACH
      echo "</tr>";
      }  // End of While
   echo "</table>";
   }
else
   {
   echo 'Unable to execute query.  Notify Global Support.';
   }  // end of IF
OCILogoff($conn);
?>

Open in new window

0
 
abruskoAuthor Commented:
Oops...disregard the comment lines, obviously!
0
 
waygoodCommented:
     foreach ($row as $item)
         {
         echo "<input type='hidden' name = 'x' value ='0'/>";
         echo "<TD width=858><font color=#990099><input type='checkbox' name='x' value='1' <?php if( (isset($_SESSION['x'])) && ($_SESSION['x']) ) echo 'Checked='checked''; ?> />";
         if ($_SESSION['factors'] == $item)
            {
            echo "checked=\"checked\"";
            }
         echo ">$item</font></td>";
         }  // End of FOREACH

should be

      foreach ($row as $item)
         {
         echo "<TD width=858><font color=#990099>";
         echo "<input type='hidden' name = '".$item."' value ='0'/>";
         echo "<input type='checkbox' name='".$item."' value='1'";
         if ($_SESSION['factors'] == $item)
            {
            echo "checked=\"checked\"";
            }
         echo ">$item</font></td>";
         }  // End of FOREACH
0
All Courses

From novice to tech pro — start learning today.