0 Replies Latest reply on Jan 4, 2011 4:24 PM by pchinique

    How to incorporate group check boxes options within the php script?

    pchinique Level 1

      I have this script, which is working fine, but I'm using group check boxes in my form and the script doesn't get me that far. Does any one knows what do I need to add to this script in order to have my check boxes working?

       

      $text = "Results from form:\n\n";
      $space = ' ';
      $line = '
      ';
      foreach ($_POST as $key => $value)
      {
      if ($req == '1')
      {
      if ($value == '')
      {echo "$key is empty";die;}
      }
      $j = strlen($key);
      if ($j >= 20)
      {echo "Name of form element $key cannot be longer than 20 characters";die;}
      $j = 20 - $j;
      for ($i = 1; $i <= $j; $i++)
      {$space .= ' ';}
      $value = str_replace('\n', "$line", $value);
      $conc = "{$key}:$space{$value}$line";
      $text .= $conc;
      $space = ' ';
      }
      mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
      echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
      ?>

       

      ---Here is the form itself----

      <form action="http://www.southsunbeads.com/signup.php" method="post" name="form1" id="form1" onsubmit="MM_validateForm('Email','','RisEmail');return document.MM_returnValue">
        <table width="190" border="0"  cellspacing="8">
         <tr>
            <td colspan="2" bgcolor="#FF9900"><span class="signup">Sign up for promotions &amp; events:</span></td>
          </tr>
          <tr>
            <td nowrap="nowrap">*<label for="E-mail">E-mail:</label></td>
            <td><input name="Email" type="text" id="Email" onblur="MM_validateForm('Email','','RisEmail');return document.MM_returnValue" /></td>
          </tr>
          <tr>
            <td colspan="2">*Choose one or more options:</td>
          </tr>
          <tr>
            <td colspan="2"><p>
              <label>
                <input type="checkbox" name="ChooseOption" value="yes" id="ChooseOption_0" />
                Bead deal of the day</label>
              <br />
              <label>
                <input type="checkbox" name="ChooseOption" value="yes" id="ChooseOption_1" />
                Jewelry deal of the day</label>
              <br />
              <label>
                <input type="checkbox" name="ChooseOption" value="yes" id="ChooseOption_2" />
                Online Newsletter</label>
              <br />
              <label>
                <input type="checkbox" name="ChooseOption" value="yes" id="ChooseOption_3" />
                San Diego Newsletter</label>
              <br />
              <br />
            </p></td>
          </tr>
          <tr>
            <td colspan="2"><input type="submit" name="button" id="button" value="Submit" /></td>
          </tr>
        </table>
      </form>

       

      Thank you