I'm hoping you can help me as I'm at a loss.
I have a contact form which requires the user to enter their birthday which is all sent via email. My problem is that I can't seem to get my code to accept the day, month and date.
At the beginning I had it as an input which worked fine but I wanted to rather use select boxes and it keeps a consistent look but I have never worked with select tags in php before.
This is the HTML - I have removed all but 2 of the options in each select tag to save space.
<div class="formfield"> <div class="labelbox"><label for="dob">Date of Birth:</label></div> <div class="inputbox"><select name="dob_dd" type="text" class="field" id="dob" tabindex="4" value="<?= $_SESSION['myForm']['dob']; ?>"> <option value="0" disabled="disabled" selected="selected" style="color:#9999FF;">Day</option> <option value="1">1</option> <option value="2">2</option> </select> <select name="dob_mm" type="text" class="field" id="dob" tabindex="5" value="<?= $_SESSION['myForm']['dob']; ?>"> <option value="0" disabled="disabled" selected="selected" style="color:#9999FF;">Month</option> <option value="January">January</option> <option value="Febuary">Febuary</option> </select> <select name="dob_yy" type="text" class="field" id="dob" tabindex="6" value="<?= $_SESSION['myForm']['dob']; ?>"> <option value="0" disabled="disabled" selected="selected" style="color:#9999FF;">Year</option> <option value="2004">2010</option> <option value="2004">2009</option> </select> </div> </div>
I'm sure this is where the problem is - I need to tell the code to take dob_dd, dob_mm and dob_yy and covert it to dd/mm/yyyy.
$dob = trim($_POST['dob']);
This is my if statement but I'm sure I can sort that out ones I have the date code working.
if (empty($_POST['dob']) ) {
$errors[]='You forgot to enter your date of birth';
}
Any assistance will be appreciated.

New Topic/Question
Reply




MultiQuote




|