Jump to content

jdhorn

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jdhorn's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the response. Unfortunately neither of these solutions works. After playing around with the code this seems to work. <?php $gender=$_POST['gender'.((int)$i+1)] ?> <label>Gender </label> <select name="gender<?php echo (int)$i+1;?>" id="gender<?php echo (int)$i+1;?>"> <option selected><? echo "$gender" ?></option> <option value="Male">Male</option> <option value="Female">Female</option> </select> However this sets gender1 = $gender then overwrites this value with gender2 etc. How can I write all these value to their own code and then call each one with echo?
  2. I actually ran into another issue while implementing the code. I use a dynamic based upon the number of items the user selects for a certain category. <label>Gender </label> <select name="gender<?php echo (int)$i+1;?>" id="gender<?php echo (int)$i+1;?>"> <option value="Male">Male</option> <option value="Female">Female</option> </select><br /> How would I use the code you provided in this scenario?
  3. The website form that I need help on requires users to fill out certain fields and if those fields are not filled out the form resets with text requesting the user to populate the fields. The problem I am having is that all drop down values are resetting when my form displays the error message. However text fields that users manually fill in data do not reset. I am using <select> and <option> tags for my drop down menus and <input> tags for my fields. How can I keep the drop down values from resetting? Do I need to change the way I display the error message? Click here for the website form in question. Here is the code for the required fields. if ($_POST && !$_POST['drvset']) { //var_dump($_POST); $required = array ("name","byear","bmonth","bday","propertyaddress","zip","email1","email2","homephone"); foreach ($required as $key => $value) { if ($_POST[$value] == '') { $err = 1; } if (($value == 'byear' && $_POST['byear'] == '0')||($value == 'bmonth' && $_POST['bmonth'] == '0')||($value == 'bday' && $_POST['bday'] == '0')) { $err = 1; } if ($err == '' && $_POST['email1'] != $_POST['email2']) { $err = 2; } }
×
×
  • 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.