Right I have a bit of a dilema. Well for me anways.
Im currently creating a system but im having difficulties. Im making a sign up forum. It only has 4 fields.
Im trying to once sumbited (to the same page) It checks to see if they are all filled in. So im using if (!isset($_POST['username'])) This works fine and dandy. But at the top of my docuement I want to run a query on my database on the condition that
username,fname,lname,email, an eregi email pattern are all filled in aproprealey.
So basicly whats the best way to create a big if statment?
This is what im basing most of my code on at the moment. (its for a style sheet here)
<?php
if (isset ($_POST['submit'])) {
if (empty ($_POST['username'])){echo (".username{color: #FF0000;}\n");};
if (empty ($_POST['fname'])) {echo (".fname{color: #FF0000;}\n");};
if (empty ($_POST['lname'])) {echo (".lname{color: #FF0000;}\n");};
if (empty ($_POST['email'])) {echo (".email{color: #FF0000;}\n");}
elseif (!eregi(".+@.+\..+",$_POST['email'])) {echo (".email{color: #FF0000;}\n");};
};
?>
Any help apriciated thanks.
ill sketch out what i mean
if ( username && fname && Lname && email && Email pattern) {check my database for duplicates}
Thanks.
Edit:
Would this work?
<?php
if (isset ($_POST['submit'])) {
if (
(!empty ($_POST['username']) && (!empty ($_POST['lname'])) && (!empty ($_POST['email'])) && (eregi(".+@.+\..+",$_POST['email']))
{echo ("Sql");};
};?>