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
Share on other sites

im using php 4 so i can not use the try block for my exception handling. Ive got various things to check like if the form is filled out, password lengths and so forth. What can i use instead of try?

 

if

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.