Validating and sticky'ing an array
Posted: Wed Sep 29, 2010 6:33 am
Hey guys! Basic php problem here, hope you are up for it!
I have a form with an array from which users can select date of birth. I am trying to validate the selection when they press submit, and also make their selections sticky.
I have tried my way around the different codes, and my latest attempt looks like this:

I have a form with an array from which users can select date of birth. I am trying to validate the selection when they press submit, and also make their selections sticky.
I have tried my way around the different codes, and my latest attempt looks like this:
As far as i know i could be close, but i guess i could also be way of. Hope you guys will take some time to help me<?php
$year = 1960;
while ($year <= 2010) { $year ++;
echo "<option value=\"$value\"" }
//making the selection sticky
if(isset($_POST['year'])) && ($_POST['year'] == $year)){
echo "selected=\"selected\"";
//end sticky
}
echo ">$value</option>n";
}
?>