Solved

PHP Syntax Help

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

831 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