So I'm sure my solution is an easy one, but it just seems to escape me. I have a basic webpage where a user needs to be able to type in a beginning string of a state, hit search, and the page will output all of the states that begin with that string.
For example, if "co" was entered, then Colorado and Connecticut would be displayed, with the input case insensitive if possible. This inpt string should be able to be any length. I am using an array of $states to hold all 50 states that need to be searched. Below is what the basic form looks like.
<h1>Search States</h1>
<form method = "post" action = "states.php">
<p>Search:
<input type="text" name="search"></p>
<p><input type = "submit" value = "Submit"></p>
</form>
<?php
$states = array('Alabama',
'Alaska',
'Arizona',
'Arkansas',
'California',
'Colorado',
'Connecticut', etc, etc.
I assumed that some kind of regular expression search is what I am looking for, but I can't find how to produce one based off of input and using more than one character at times.
Thank you!