// Pulldown to select a country
// Set default selection:
$default_pulldown_selection = '0';
//For validation, you're looking for the contents of the $_POST['choir_country'] variable
// this is only set after "submit" is clicked.
$pulldown_selected_item = (isset($_POST['choir_country'])) ? $_POST['choir_country'] : $default_pulldown_selection ;
//build an array of entries to be displayed on the template for field 'choir_country':
$pulldown_contents[] = array('id'=>'0', 'text'=>'Please Select');
$pulldown_contents[] = array('id'=>'1', 'text'=>'England');
$pulldown_contents[] = array('id'=>'2', 'text'=>'Wales');
$pulldown_contents[] = array('id'=>'3', 'text'=>'Scotland');
$pulldown_contents[] = array('id'=>'4', 'text'=>'Northern Ireland');
// Validation for the 'choir_country' selected field here.
if ($pulldown_selected_item==0) {
$messageStack->add_session('header','You must select a country, please','error');
}
Bookmarks