Hi,
I am converting an existing website to php. I have created a backend that allows the website owner to add their page content to a mysql database or amend existing content. I also have working code that adds the code from the database into a web page.
The webpage is made up of 3 sections:
1. Header
2. Side menu
3. Main content area.
I have used the php 'include' statement to add the header and side menu bar to all my existing pages plus code to bring the text from the database into the main content area. But I think I have gone about this all wrong as I now have 10 php webpages and the only difference between them is the 'WHERE' clause in the sql statement (that brings in the main content).
Question:
Is it possible to get a value into a variable when a side menu item is clicked so that my sql statement is changed (and refresh the page/reload it) so that I only need one page instead of 10?
Thanks
How to get one webpage to display different content from db
Moderator: General Moderators
Re: How to get one webpage to display different content from db
If you look at the end of address bar in your browser, you should see a question mark followed by variable names and values. If I understand your question correctly, one of the easiest way to do it would be to associate your menu links in this way. When your page loads, it reads these GET variables and changes the SQL query appropriately.
Re: How to get one webpage to display different content from db
Sorry for the delay, I was just testing to make sure I could do it.
Thanks so much for that, it works just the way I want it to. I thought it would be something along those lines but I couldn't work it out because I had only used $GET with forms.

Thanks so much for that, it works just the way I want it to. I thought it would be something along those lines but I couldn't work it out because I had only used $GET with forms.