Antonio102 Antonio102 - 3 months ago 10
HTML Question

Login/registration button to open php file on same page

First of all sorry for my English. I'm working on a little website (I'm learning web design and PHP). As you can see in the page

index.php
, there are three buttons: login, registration (register) and guest. I've three scripts, one for login, one for register and one for guest access to site.

How can I show the script "login.php" or "register.php" or "guest.php", just under the buttons, when I click on the corresponding button?

Here are index.php and css files:

Download

Answer

use jQuery http://www.jquery.com makes life soo much easier

$(document).on("click","#login-btn",function(){
    $("#div-where-to-load-stuff").load("url/to/login.php");
})

this is very bare bones. there are better ways to do it tho.

http://api.jquery.com/load/