Solved

PHP Syntax Help

Posted on 2014-01-30
2
178 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 108

Expert Comment

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will learn how to count occurrences of each item in an array.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now