newbie question about multiple actions on php

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I need help trying to send my post method to two php files.  My form is
so simple, it's like <form action="page1.php" method="post" ...

What I want to do is to say, action="page1.php" and have the same post
information to get sent to like a action="page2.php"  How would one do

An overview is that I have 3 checkboxes and a submit button, i'm
already sending that information to page1.php but i want to send the
exact same information to page2.php.  Can anybody help me out with


Re: newbie question about multiple actions on php wrote:
Quoted text here. Click to load it

You are leaving out a critical piece of information: is page2.php
supposed to produce output visible to the user, and, if so, can it be
combined with that of page1.php?  If page2.php produces no output or
its output can be combined with that of page1.php, you can simply
include page2.php into page1.php; the $_POST array will be available to
both segments of code.

If page1.php and page2.php are supposed to be viewed sequentially, you
may want to consider an alternative data exchange mechanism such as


Re: newbie question about multiple actions on php wrote:
Quoted text here. Click to load it
What do you expect the browser to be displaying after you have posted to  
both page1.php and page2.php?


Re: newbie question about multiple actions on php

Heres the thing, I just started on this project for the week, never
have done any php, html, javascript ever and i'm just thrown into it.

the whole program is alot more complicated....
thanks for the quick reply though

first off, i'm working with existing code, so i'm doing maintence, I'm
adding features.
so far theres already a working find that sends the information.  since
im so new at this, theres a file called gameframe.php where it connects
to a topmenu.php and gamelist.php.
heres some code for the topmenu.php find
<form name="searchForm" method="GET" action="gamesList.php"
target="mainFrame" onSubmit="submitSearch(<?php echo
$_SESSION['linkIndex']; ?>);">

this is submit search
function submitSearch(index)

heres a block of code from gamelist.php
function updateLinks(data,hardware,index)
    var i=0;
    while (i <
        if (hardware ==

I hope i have pasted enough code... the find button works

since i'm such a newbie.. my "filter for checkboxes" code looks like
<form action="topMenu.php" method="post" >

  $year_answer = $_POST[year_answer];
  $genre_answer = $_POST[genre_answer];
  $esrb_answer = $_POST[esrb_answer];

it works for me in topmenu.php....
but i want that exact same information sent to gamelist.php

So, what help can i get?
and thanks again for the prompt reply.


Re: newbie question about multiple actions on php

There are a few ways to do it, but if you aren't displaying the results
on the next page, I would just do something like:

1. Rename the form variables to start with something like "in_"
(something parseable, but unique, i.e. "in_username", "in_checkbox",
2. On page 2 create a loop inside the form that looks for the "in_"
part of the element name and creates hidden variables for each one.

       if(substr($key,0,3) == 'in_')
                echo '<input type="hidden" name="in_' . substr($key,3)
. '" value="' . $val . '">';

3. Continue prefixing each of the form elements that you want to pass
and including the code on each consecutive page.

Re: newbie question about multiple actions on php

Ok, I made a wayyy too complicated reply before.

Let me try to explain it from my understanding.

inside topmenu.php
this works
<form action="topMenu.php" method="post">
<input type="checkbox" name="year_answer" value="Year"> Year

$year_answer = $_POST[year_answer];
if ($year_answer == 'Year')
That's how i use the check box in topmenu

the code i have in gamelist.php is this
$year_answer = $_POST[year_answer];
if ($year_answer == 'Year')

and that will also work given i use this code in topmenu.php
<form action="gamesList.php" method="post" target="mainFrame">
<input type="checkbox" name="year_answer" value="Year"> Year

So what i want to do is something like... <form action="topMenu.php"
AND action="gamesList.php" ...

How can i do this?


Re: newbie question about multiple actions on php wrote:
Quoted text here. Click to load it
i think you're just going to have to have one file include the other.
Then the same $_POST'd array will be available to both

Site Timeline