Hi there, I am stuck in the php validation. In my form have to show list banks by in my form, if the client may be enter the correct name or enter few char and select the bank name from datalist.if Suppose the client enter any name (except exist bank name from list), have to validate like please select banks from database only.

<?php
echo "<input id=\"bankname\" list=\"bankname1\" style='width:400px;' class='form-control' name='bankname' value='$bankname'>
<datalist id=\"bankname1\" >";
$sql="SELECT * FROM bankmaster ORDER BY bankmasterid ASC ";  // Query to collect records
foreach ($DB->query($sql) as $row) 
{
echo  "<option value=\"$row[bank_name]\"/>"; 
}
echo "</datalist>";
?>

cant you put the bank names into an array then check
if in_array?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.