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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:25:26+00:00 2026-06-17T13:25:26+00:00

My index.php page has several submits within a form which has method post and

  • 0

My index.php page has several submits within a form which has method post and action referencing another PHP page. For ease of example, let’s say there is submit=’a1′ and submit=’a2′.

When the $__POST variable is sent from the submit button, I want the new PHP page to select which $__POST variable was sent. I have the query and display script made already and it works fine for one $__POST if i use if(isset($__POST['a1'])), for example. And I can iterate the MySQL query and use if() statements for each category i.e.. ‘a1’, ‘a2’…

What I want to do is iterate within a loop because the MySQL query is the same for each category, with the exception of the WHERE statement which identifies category fields in my database according to a change in category number. For instance, category ‘a1’ uses same mysqlquery as ‘a2’, only difference being: ( WHERE post_id = '1' for ‘a1’ and WHERE post_id = '2' for ‘a2’.)

The code is immaterial..it already works. I just need to determine which post variable was sent to the page so I can iterate the MySQL query from each corresponding post_id…I suspect OO programming would help here, but I am curious if I need it or not.

  • 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-17T13:25:28+00:00Added an answer on June 17, 2026 at 1:25 pm

    Can’t you do something like:

    for ($i=1; $i<=100; $i++)
     {
       if(isset($_POST['a'.$i])) {
       //Do something
     }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing web page which has main file index.php as follows: include('UserClass.php'); include('html/top.php'); $user
My PHP site has header,body,footer files that are included into the INDEX.PHP page. On
I want to redirect to the page which has a form when user submit
I have a php page which has two submit buttons that are meant to
I have a index.php page that is the main page. All pages are included
I have my index.php page and just afrer my header i want to include
I have a function that I use on index.php page and I would like
i have a question, i have a index.php page that is the intro of
I have the following scenario. I have a index.php page with the following JQuery
i have a dynamic php web page localhost/ctd/index.php All working good except if i

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.