|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (10 bit)
|
combining php w/ html...
On a test-site im developing(mostly to learn php/mysql), I have a user registration area. Now if they fill out the form, but either forget to input a required element, or if the email or username is already in the database, it gives an error message. Only problem is the error messages show up at the very top of the site, about the banner etc. How do I get these to show in the same place taht the form is?
Check it out to see exactly what I mean: http://dcrcomps.net/gathering/register.html Just dont put in an email address to see what i mean. Next thing, and it goes along with the last thing, if someone does register successfully, how can I get that message displayed in the same spot as the form? Right now I just have it doing an echo "you are registered..blah blah blah" at the bottom of my register.php, so its just a blank white page with the statement on it. I assume that somehow the html and php have to be combined somehow, but Im not sure exactly what to do. attached is my register.html and register.php files. Thanks |
|
|
|
|
|
#2 |
|
Member (8 bit)
|
just put the echo code for the error output within the table.
i can't open .zip files from this computer, but i assume that you have all your php at the top, then the html after it. you can put php anywhere in a .php file, as long as it is between tags...and also as many instances as you want... so still run your test vars at the top, then just output the array right about the table. -neo |
|
|
|
|
|
#3 |
|
Member (9 bit)
|
One of the more popular ways to do this is to create a system of error codes, such as the following:
1. First Name not entered 2. Last Name not entered 3. Email not entered 4. Username not entered Let's say they did not enter FirstName, LastName or UserName, then the error code would be "124", stored in the hidden form field named "code" and processed thus: PHP Code:
![]() Hope to help. Last edited by MrAustin; 08-11-2004 at 06:53 PM. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|