but what if I wanted the variable $error to be a message. I want to set a variable called $error to something like "invalided password" then display this on the login page.
Cheers Matt ----- Original Message ----- From: "Tom Rogers" <[EMAIL PROTECTED]> To: "matthew oatham" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, March 04, 2004 12:24 AM Subject: Re: [PHP] setting request variables > Hi, > > Thursday, March 4, 2004, 9:08:19 AM, you wrote: > mo> Hi, > > mo> I have created a small login system for my website. However > mo> if a user logs in incorrectly I want to display a error message > mo> currently I use the code > > mo> echo "You could not be logged in! Either the username and > mo> password do not match or you have not validated your membership! > mo> <br /> > mo> Please try again! <br />"; > mo> include ("login.php"); > > mo> However this appears at the top of my website but I want it > mo> to appear above the login form so I though I could set a variable > mo> in the request called "error" or similar then on the login page > mo> just above the login form check for the presence of the request > mo> variable "error" and print the appropriate message. So I want to > mo> do the following: > > mo> SET REQUEST VARIABLE ERROR HERE > mo> include ("login.php"); > > mo> But can I set a request variable? i.e in JAVA I would do > mo> HttpRequest.setAttribute("error", true); etc.. > > mo> Any help? > > mo> Cheers > > add something like this to login.php > > if(!empty($error)){ > echo '<tr><td>'.$error.'</td></tr>'; > } > > as it is included it will have $error available to it > -- > regards, > Tom > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php