--- Wade Smart <[EMAIL PROTECTED]> wrote: > Im evaluating a page and based on that data, I want to send the user to > another page. I havent used it much but, I thought about using the header > function: > > if(isset($_POST['submit'])){ > $_SESSION['values'] = $_POST; > header("Location: page_redirected.php"); > exit; > } > > This is just some test code I worked up to workout some ideas. > Is the above not possible? Sense nothing is being read to the browser, would > > this not work? > > WADE
You don't say if you are getting an error. A common one here is a complaint that the header can't be written (or changed) because it had already been sent and the number of the first line with output to the browser would be displayed in the error message. This can occur when there's static HTML or a print statement above your PHP block of code. A print or echo above the header() function will also cause problems. Start the opening PHP tag on the first line of the program in the first character position. If the "_____" represents the top of the page (don't include it) in your program: _____ <?php session_start(); if(isset($_POST['submit'])) { $_SESSION['values'] = $_POST; header("Location: page_redirected.php\r\n"); exit; } To use sessions, you must have a session_start() function call near the top as well. The carriage return and newline ("\r\n") are included to send a proper HTTP header call. It may sometimes work without it but it's best to do things correctly for the standards-compliant browsers. Obviously, the file page_redirected.php must exist in the same directory as this script. James