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.
Can’t you do something like: