Click to See Complete Forum and Search --> : Pass $_POST along


socken
02-08-2006, 04:11 AM
Hi all! :cool:
I've created a form with multiple pages. The first page, form1.php, contains three methods:

show_form(), validate_form(), process_form().

Everything works fine, the form gets displayed and validated. If errors occur, the form gets displayed again with error messages.
NOW: If no errors occur, I want to submit the data to form2.php! How do I do that in the process_form()???

I had it sent to form2.php with the submit button, but now that I have a validation, I have no idea on how to do that?! :confused:

NogDog
02-08-2006, 07:31 AM
See this very recent thread for some info: http://www.webdeveloper.com/forum/showthread.php?t=94405

socken
02-08-2006, 07:46 AM
Thanks for your answer. The problem is, I'm using sessions already, and I'm using $_SERVER[PHP_SELF] as action-command. So when everything is correct, I'm in a method called 'process_form()'. What command do I have to use now, to get to form2.php?
I first save everything in the session, then the data is available at the second page. But how do I get there?

cbrookes
02-08-2006, 07:57 AM
header("location: form2.php");

ShrineDesigns
02-08-2006, 08:47 AM
example<?php
session_start();

if($_SESSION['step'] == 1)
{
// ...
$_SESSION['step'] = 2;
}
else if($_SESSION['step'] == 2)
{
// ...
$_SESSION['step'] = 3;
}
else if(!isset($_SESSION['step']) && $_POST)
{
// ...
$_SESSION['step'] = 1;
}
?>

socken
02-08-2006, 09:06 AM
Thanks alot! That worked! ;-)