This Message Forum is no longer in use

Please use the new Bravenet Help Forums FOUND HERE

General Forum
This Forum is Locked
Author
Comment
can someone please give information on how to do this?

how do you make it so when someone clicks on a button on a website a box comes down with stuff in it like if you go to http://ogame.us/ and click on login that box comes down and also how do i get a registration form and a login form on the same page like in that website?

thanks in advance for any answers

Browser: IE7

Re: can someone please give information on how to do this?

You can use javascript to show and hide elements like that. A basic implementation is at http://scutterman.com/Bravenet/js_login/. You can view the source to see everything going on.

It has a login and registration form, both hidden to start with, that have buttons to show/hide them. I've got some basic styles there, but with a little time it can be made to fit in with whatever styles you already have.

The forms don't work because I don't have the login.php or register.php files, which brings me to your next question...

You can have more than one form on a page by putting each in its own form element. That way you can specify the action of each form, which tells the form where to go when it's submitted. If you look at the login and register forms on the members area/login you posted a few weeks ago you can see the actions of each of the forms telling it what page to go to.

Hope this isn't too confusing
-Scut

Browser: Mozilla Firefox 3.6.*

OS: Windows 7

Re: can someone please give information on how to do this?

If you have mutliple forms, or multiple scripts, on a page it is essential that you do not duplicate the names of elements between the two. As long as every single field and variable on the page has a unique name you will be OK.

Re: can someone please give information on how to do this?

Repeating the names of elements is okay, but each form should have a unique name. Each id on a page needs to be unique, but sometimes names need to be duplicated, such as using radio button or checkbox groups.

As far as the example I posted goes, in a live situation I would be having the forms both sumbit to the same page and having the name of the button tell the script which action to take so I may use different names to make the script easier to follow, or I may make them the same so I can reduce the amount of code.

Browser: Mozilla Firefox 3.6.*

OS: Windows 7

Re: can someone please give information on how to do this?

one more question how do i make code appear as text on a website?

Browser: IE7

Re: can someone please give information on how to do this?

There's several ways. Using PHP you should look into the htmlspecialchars() and htmlentities() functions.

Using plain html your best bet is probably the textarea. You can use style="border: none;" and other css to make it fit in better with the page.

Hope this helps
-Scut

Browser: Mozilla Firefox 3.6.*

OS: Windows 7