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 6588035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:59:43+00:00 2026-05-25T16:59:43+00:00

I am currently a bit stuck in finding out how to compare these variables

  • 0

I am currently a bit stuck in finding out how to compare these variables against eachother, I have 24 dropdown selections with 24 options to choose from within each one, I then post them to the PHP page. What is the easiest, most efficient way of comparing each of these values against each other to check that each option that is chose is different from each other as none of the 24 options can be the same. I know that an array is the way forward with this, just not sure on how to compare them.
Any help is much appreciated.

    $id = $_POST[trackid];
    $pos1 = $_POST[pos1];
    $pos2 = $_POST[pos2];
    $pos3 = $_POST[pos3];
    $pos4 = $_POST[pos4];
    $pos5 = $_POST[pos5];
    $pos6 = $_POST[pos6];
    $pos7 = $_POST[pos7];
    $pos8 = $_POST[pos8];
    $pos9 = $_POST[pos9];
    $pos10 = $_POST[pos10];
    $pos11 = $_POST[pos11];
    $pos12 = $_POST[pos12];
    $pos13 = $_POST[pos13];
    $pos14 = $_POST[pos14];
    $pos15 = $_POST[pos15];
    $pos16 = $_POST[pos16];
    $pos17 = $_POST[pos17];
    $pos18 = $_POST[pos18];
    $pos19 = $_POST[pos19];
    $pos20 = $_POST[pos20];
    $pos21 = $_POST[pos21];
    $pos22 = $_POST[pos22];
    $pos23 = $_POST[pos23];
    $pos24 = $_POST[pos24];
  • 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-05-25T16:59:44+00:00Added an answer on May 25, 2026 at 4:59 pm

    Just do an array_unique on it. First you’ll need to put those POST vars into an array instead of splitting them up.

    $pos = array();
    for ($i = 1; $i <= 24; $i++)
    {
        $pos["pos$i"] = $_POST["pos$i"];
    }
    
    $unique = array_unique($pos);
    if (count($unique) == 24)
    {
        // all good!
    }
    else
    {
        // bad!
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that is currently running against a 32-bit SQL Server 2005
I currently have a 32-bit .Net application (on x86 Windows) which require lots of
I currently have a news website setup in PHP/MYSQL that's a bit old and
i'm currently creating a database program in java and i am a bit stuck
I'm currently trying to develop a message-oriented networking framework and I'm a bit stuck
Really hope someone can help me as I'm a bit stuck :S I have
I'm currently working on a C based application am a bit stuck on freeing
I'm currently playing a bit around with scheme, and I've been stuck for quite
I'm currently stuck in the distribution-profile-jungle and I can't find my way out. I
I'm learning haskell. Currently working through 99 questions , a little bit stuck on

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.