Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9068669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:14:44+00:00 2026-06-16T17:14:44+00:00

I have some code that looks like this: <div class=container> <aside class=sidebar> <a href=index.php?Cat=members><h3>Members</h3></a>

  • 0

I have some code that looks like this:

<div class="container">
    <aside class="sidebar">
        <a href="index.php?Cat=members"><h3>Members</h3></a>
        <a href="index.php?Cat=prodcat"><h3>Product Categories</h3></a>
    </aside>
<article class="content">
    <section>
        <?php
        echo $_GET["Cat"];
        if ($_GET["Cat"] = 'members'){
            $membership = New Membership();
            $membership->member_List($sort);
        }
        else if ($_GET["Cat"] = 'prodcat'){
            $membership = New Membership();
            $membership->prodcat_List();
        }
        else {
        echo 'Welcome';
        }
        ?>
       </section>
    </article>
</div>

What should happen, is that when the link Members is pressed. The page should reload itself and show only what is brought back from the member_list.
Or if the product categories link is then pressed – it should then show whatever comes back from prodcat_list.

The problem is. Once I load the index page whatever comes back from the member_list appears straight away. Despite no ‘Cat’ being declared in the URL. Once this happens, I cannot then use the links to change it.

As you can see I have an echo for the $_GET[“Cat”]. It is changing every time the page changes.

However the rest of the page is not. I have no idea why. Nor can I work out how to fix this. If I swap the if/else if statements around. I can get the prodcat_list to appear. But then I have the same problem trying to get the member_list to appear. NFI what is going on. Im only an amateur with PHP. Getting better every day though. But I’ve a long way to go.

EDIT

I’m an idiot. Thanks everybody! ==

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:14:46+00:00Added an answer on June 16, 2026 at 5:14 pm

    This

    if ($_GET["Cat"] = 'members'){
    

    should be like this

    if ($_GET["Cat"] == 'members'){
    

    Note the == instead of your =! Likewise in the other if clauses later on.

    If you use just a single =, you actually do an assignment. So in your case, in the if clause you try to assign the value member to the variable $_GET["Cat"]. As there is nothing wrong with that assignment, it is executed and the if-clause evaluates to true.

    For comparisons use == or ===. The single = is just for assignments!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code on my page that looks like this: <div class=img-center> <img
I have a piece of code that essentially looks like this: <div class=parent> <a
I have some HTML that looks like this: <h2>Heading</h2> <div class='myClass'> <h2>Another Heading</h2> </div>
I have code that looks like this: <div class=tag>Order # :</div> <div class=data> <input
I have some code that looks like this: foreach(var obj in collection) { try
I have some code that looks like this: var MyObject = function () {
I have some code that looks like this. There is also an autoincrement field
So I have some code that looks like this: <asp:BoundField DataField=CreatedOn HeaderText=Created on SortExpression=CreatedOn
In VS 2005, I have some code that looks like this: ifs.open(foo); while (!ifs.eof())
I have pasted some code that looks like this: Dto = new MyDto() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.