Quote:when i enter any letter say "ra" "na" etc in the input box it should display all the items which all contain in the salald list, how can i do this ? can any one help me to solve this problem, Below is the code what i have tried with.
<!DOCTYPE html> <html> <body> <?php $veggies = array("Potato", "Cucumber", "Carrot", "Orange", "Green Beans", "onion"); $fruits = array("Apple", "Banana", "orange", "Pineapple", "Grapes", "Watermelon"); $salad = array_merge ($veggies, $fruits); $Object = 'ra'; $search = array_filter($salad, function($list) use ($Object) { return ( stripos($list, $Object) !== FALSE ); }); print_r($search); ?> <form method="POST"> Search item: <input type="text" name="txt" ><br> <br> <input type="submit"> </form> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)