Welcome Guest, Not a member yet? Register   Sign In
Form Dropdown Validation
#1

[eluser]Juan Velandia[/eluser]
Hello Everyone. Wich aproach would you use to validate this dropdown

Code:
$report = array();
$report[0]= 'Please Select';
$report[1]= 'Sales';
$report[2]= 'Products';
$report[3]= 'customers';

echo form_dropdown('Report', $report, '');

To make users to select something else than "Please select". Thanks in advance!




#2

[eluser]Aken[/eluser]
1) Create an array of valid options (excluding "Please Select").
2) When you generate the dropdown, add the "Please Select" option there (use array_merge() or something).
3) Use your original valid options array to compare the value.




Theme © iAndrew 2016 - Forum software by © MyBB