PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
//declaring variables
$f_name="chuck"; $l_name="bob";
//Validation of first name and last name looking for special symbols and numbers
if (!preg_match('/[a-zA-Z]/', $l_name|| $f_name))
{
echo "Your name must be only alpha numberic characters A-Z or a-z.";
}
?>
But I don't think that's what you want. That will display the error only if there are no letters. I think you want if there are other than letters? Maybe this:
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
AbraCadaver's suggestion works in this situation because of what you're doing and with what data. In general, if you want to do something with two variables you need to repeat yourself:
AbraCadaver--Yep, I see. Never thought about concat.
tasairis --Yes, this was actually what I was thinking. It make sense to do it this way. I just thought the fuction could read the OR without the repeat.