0

Hey friends i just wanna know how can we change the url like if i have a index page now i want to include the login page on click to a link now the url should be index.php?action=login

3
Contributors
7
Replies
9
Views
5 Years
Discussion Span
Last Post by diafol
0

i am using the swith case but when i am trying to insert some values its not inserting into the database.

0

let me explain my question I have to create a index page in php now in index page i have multiple links like login, registration,view products,add products in the side bar.
i just want to know when a user clicks on login then url should be like index.php?subject=login or if he clicks on add category index.php?subject=category and the pages according to the url changes will be displayed.

0

So what you're saying is there is only index.php and that you're changing the served content based on the url parameter 'subject'. I assume you're using include files for this?

if(isset($_GET['subject']) && file_exists('templates/' . basename($_GET['subject']).'php')){
  include('templates/' . basename($_GET['subject']).'php');
}else{
  include('templates/index.php');
}

Not tested.

0

Thanks Ardav for the help and one more thing is that when i am adding any category to the database it throws me to the again index.php though i have put the action to the list.php

0

Could you show the code that you're using for this and the url that's appearing?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.