Skip to content
Advertisement

How to Set my URL pattern in my php using get method parameters only

I have 3 php files in my directory(/account):

  1. index.php
  2. login.php
  3. signup.php

Accessing the folder in my localhost:

http:localhost/account ==> opens the default(index.php file)

I want to access the login.php and signup.php using:

JavaScript

and

JavaScript

respectively.

Here is my code in the index.php

JavaScript

Please help to get me a way to get my URLs like that…

Advertisement

Answer

You have the key login and signup but no value so you should check whether the key exists with isset().

JavaScript

In case you want to use switch instead,

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement