@NogDogNov 28.2009 — #The parameter for empty() must be a variable, not a function call. How about: [code=php] if(trim($_POST['username']) !== ''); [/code]
@ServauxauthorNov 28.2009 — #Thanks NogDog...seems like I should have posted the rest of the code...I made that change and then I had syntax errors on three lines
@NogDogNov 28.2009 — #Please make use of this forum's [noparse][code=php]...[/code][/noparse] tags when posting PHP code samples: it makes life much easier on those who might want to help.
The opening if condition would need to be something like: [code=php] if(trim($_POST['username']) !== '' && trim($_POST['email']) !== '') { [/code] As to the rest, the curly braces do not balance out, but I'm guessing that may be due to not having all the code here, so I don't know if it's a problem or not.
@ServauxauthorNov 28.2009 — #Hi NogDog thanks for your help I have implemented the changes and receive new syntax errors. configuring some of the curly braces only generated more erros starting with $uname and my else statement above the echo"please fill out both fields!"
Here is the code [code=php] <?php
// Initialize session data session_start();
/* * If the user is already registered, display a * message letting them know. */ if(isset($_SESSION['username'])) { echo "You're already registered as $_SESSION[username]."; }
// Checks if the form was submitted else if($_SERVER['REQUEST_METHOD'] == 'POST') {
} /* * If the user did not fill out both fields, display * a message letting them know that both fields are * required for registration. */ else { echo "Please fill out both fields! <br />"; } }
// If the form was not submitted, displays the form HTML else {