Jump to content

try


westminster86

Recommended Posts

Try is for exception handling--for example if there's a server problem don't expose your mySQL code to the browser.

 

Here's the code I use to validate my contact form--this portion checks to make sure the Name field is filled in.


if (eregi ("^[[:alpha:].' -]{2,50}$", stripslashes(trim($_POST['first_name'])))) {
	$fn = escape_data($_POST['first_name']);
} else {
	$fn = FALSE;
	$validForm = false;
	echo '<p><font color="red" size="+1">Please enter your first name.</font></p>';
}

Link to comment
https://forums.phpfreaks.com/topic/99848-try/#findComment-510669
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.