Jump to content

anthonyreed

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by anthonyreed

  1. Fairly new to PHP, so I am apologizing up front: Trying to get a couple check boxes to work when going to a MySQL database. They keep coming up "No" no matter what I do: Form Page: <?php if($_COOKIE['newsletter']=='No') echo ' <input type="checkbox" name="newsletterselect[]" value="newsletter" /><label class="Text"> Newsletters by Email </label>'; else echo '<input type="checkbox" name="newsletterselect[]" value="newsletter" checked /><label class="Text"> Newsletters by Email</label><br>'; ?> Processing Code: $newslettersselect[0]='No'; if(isset($_POST['newslettersselect'])){ foreach ($_POST['newslettersselect'] as $value){ if($value=='newsletters') $newslettersselect[0]='Yes'; } } setcookie("newsletters", $newslettersselect[0], null, "/", ".WEBSITENAMEHERE.com"); I have noticed that whenever I change the first line of the processing code (currently where it says 'No', that is the answer that shows up. If I change that to "yes", then I get "yes" in the database every time.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.