Hello I want to verify that all the fields in the array $key in which the first letter is M, but there is a problem which is:
Warning: preg_match() expects parameter 2 to be string, array given in C:\AppServ\wwwegx1.php on line 15
<?php
if (isset($_POST['zr'])){
$pattern = "/^m/";
$key = array($_POST['text'],$_POST['text1'],$_POST['text2'],$_POST['text3']);
if (preg_match($pattern,$key))
echo 'is Mathcing M is First!';
}else {
echo "M it's Not First!'";
}
?>
<form action="regx1.php" method="post">
<input type="submit" name="zr" />
<br />
<hr />
<input type="text" name="text" /><br />
<input type="text" name="text1" /><br />
<input type="text" name="text2" /><br />
<input type="text" name="text3" /><br />
</form>
.