This is custom error messaging. Julie Meloni has published a good tutorial on this, which you can find at http://www.thickbook.com. Have a look at that.
What you do is seek into your users table before creating an insert. Your form, as its action, calls itself, so you are passing your variables, including the kind of action you are triggering back to itself. So at the top you have some logic which tests Insert or update? If insert select * from usertable where username = '$username'; if count of returned records > 0 have an error condition, do something about it else create an insert statement execute it set the success flag blah blah way down in the display section if success welcome to the big user database show the rest of the form with the user's information else Please find another username, the one you want is taken (Could suggest an alternative) show rest of form with user's information, maybe a red asterisk by offending field. You already see I have a problem here as I'll end up writing the code to display form values 2x. So it needs a bit of a rethink. Maybe function to display the big red asterisk adjoining each field, thus it gets set automatically. Hmmm - maybe the field should be an array, then error messages could be matched to form elements. Hope you get the idea. This will really make sense in the context of the custom error messages tutorial at the thickbook site. Miles Thompson At 11:40 PM 12/17/2001 +0100, nautilis wrote: >Hi everybody! > >My problem is: > >I have a form to allow users in a website to register. My problem is that >when someone registers a name that is alredy taken, mysql returns a >'Duplicate entry 'username' for key 1. > >I just want to show a message to user telling that the username is in use by >another user and prompting him to choose a new one. > >I am a newbie at php and mysql so any help will be greatly appreciated. > > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]