Solved

PHP Syntax Help

Posted on 2014-01-30
2
182 Views
Last Modified: 2014-02-22
The following piece of validation code is almost correct.  However, I don't know how to write the "IF" part:
	$trimmed = array_map('trim', $_POST);
	
	$$un = $ue  = . if(isset($_POST['team_join']) && $_POST['team_join'] != "Create New Team") {echo $goal_amount .'==';})FALSE;
	
	// Check for a user login:
		if (preg_match ('/^[A-Z a-z 0-9\'.-]{2,40}$/i', $trimmed['user_login'])) {
			$un = $trimmed['user_login'];
		} else {
				echo '<p class="error">Please enter a username!</p>';
		}

		
	// Check for a Email:
	if (preg_match ('/^[\w.-]+@[\w.-]+\.[A-Za-z]{2,65}$/', $trimmed['user_email'])) {
		$ue = $trimmed['user_email'];
	} else {
		echo '<p class="error">Please enter a valid email address!</p>';
	}

	// Check for a Goal Amount:
	if(isset($_POST['team_join']) && $_POST['team_join'] != "Create New Team") {
		if(isset($_POST['goal_amount'])) {
			$goal_amount = $_POST['goal_amount'];
		} else {
			echo '<p class="error">You must unter a goal amount!';
		}
	}	

//  START IF EVERYTHING IS VALID
			
if ($un && $ue . if(isset($_POST['team_join']) && $_POST['team_join'] != "Create New Team") {echo '&&'. $goal_amount;}) {

BLAH BLAH BLAH
 }
			
		

Open in new window

0
Comment
Question by:rgranlund
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39822352
I've no idea what you are trying to do but at a guess

if (isset($un) && isset($ue) && isset($_POST['team_join']) && $_POST['team_join'] != "Create New Team") {echo '&&'. $goal_amount;}
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 39822545
Please explain the logic for line 3, thanks.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question