Project

General

Profile

« Previous | Next » 

Revision 255

Added by ryan almost 19 years ago

Added email validation to form module

View differences:

view.php
239 239
		while($field = $query_fields->fetchRow()) {
240 240
			// Add to message body
241 241
			if($field['type'] != '') {
242
				if(!empty($_POST['field'.$field['field_id']])) {
242
				if(!empty($_POST['field'.$field['field_id']])) {
243
					if($field['type'] == 'email' AND $admin->validate_email($_POST['field'.$field['field_id']]) == false) {
244
						$email_error = $MESSAGE['USERS']['INVALID_EMAIL'];
245
					}
243 246
					if($field['type'] == 'heading') {
244 247
						$email_body .= $_POST['field'.$field['field_id']]."\n\n";
245 248
					} elseif (!is_array($_POST['field'.$field['field_id']])) {
......
285 288
		foreach($required AS $field_title) {
286 289
			echo '<li>'.$field_title;
287 290
		}
291
		if(isset($email_error)) { echo '<li>'.$email_error.'</li>'; }
288 292
		if(isset($captcha_error)) { echo '<li>'.$captcha_error.'</li>'; }
289 293
		echo '</ul><a href="javascript: history.go(-1);">'.$TEXT['BACK'].'</a>';
290 294
		
291 295
	} else {
292 296
		
293
		if(isset($captcha_error)) {
297
		if(isset($email_error)) {
294 298
			echo '<br /><ul>';
299
			echo '<li>'.$email_error.'</li>';
300
			echo '</ul><a href="javascript: history.go(-1);">'.$TEXT['BACK'].'</a>';
301
		} elseif(isset($captcha_error)) {
302
			echo '<br /><ul>';
295 303
			echo '<li>'.$captcha_error.'</li>';
296 304
			echo '</ul><a href="javascript: history.go(-1);">'.$TEXT['BACK'].'</a>';
297 305
		} else {

Also available in: Unified diff