knowram Posted May 30, 2007 Share Posted May 30, 2007 I am using the header function to redirect a page. Which works great except when I want to send info to the redirected page. example: 2 pages a.php b.php If I am on page a.php which has a form on it and I hit submit there which normal refreshes back to its self but one of the check boxes are checked I have it redirecting to page b.php. The redirect works great but I would also like the rest of the variables that where submitted in the form to be accessed on page b.php. Is that at all possible? Thanks for the help Quote Link to comment Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 Why don't you just send the form on a.php to b.php? If that's out of the question, use sessions: a.php <?php session_start(); if(isset($_POST["submit"])) { // If the form has been submitted foreach($_POST as $var => $value) { $_SESSION[$var] = $value; // Now you have a $_SESSION array which is identical to the $_POST array } header("Location: b.php"); // Redirect the user } ?> b.php <?php session_start(); // From here on you can access all of the $_SESSION variables set in a.php ?> Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted May 30, 2007 Share Posted May 30, 2007 chigley beat me, but here is my post anyways. Why not just set the form to submit to page b.php? a.php <form action="b.php" method="post"> <input type="text" name="var"> <input type="submit" name="submit"> </form> b.php <?php $var = $_POST['var']; echo $var; ?> Quote Link to comment Share on other sites More sharing options...
knowram Posted May 30, 2007 Author Share Posted May 30, 2007 I am not setting the form to submit to page b.php because I have two submit buttons in the same form and depending on which is used it either has to reload its self or go to page b.php looks good however now on page b.php I am getting a Permission denied (13) error. Any ideas? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted May 30, 2007 Share Posted May 30, 2007 Post your code to page b. Quote Link to comment Share on other sites More sharing options...
knowram Posted May 30, 2007 Author Share Posted May 30, 2007 my code on page b.php or on page a.php to page b.php? page a.php is 687 lines long and page b.php is 930 lines long so i am guessing you don't want the whole page. pleas be more specific. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.