PHP : How to get the select values from a Drop Down list

This is the scenario

<select name="cars">
   <option value="volvo">Volvo</option>
   <option value="audi">Audi</option>
   <option value="toyota">Toyota</option>
   <option value="form">Ford</option>
</select>

This php code – get all everything between <select>

preg_match('/<select name="foo">(.*)<\/select>/msU',$html,$matches);
print_r($matches);
This entry was posted in PHP tutorials and tagged , , , . Bookmark the permalink.




Comments are closed.