frankstr Posted February 5, 2007 Share Posted February 5, 2007 Hello, Some days ago I posted a question about redirecting an part of a form to another webpage and to continue with a second part of the form and then to ad the data in a record of a mysql database. Somone sugested to save the first part of the form in a session variable which i tried to do, without succes. See my scriptcode and form. Has someone a suggestion how to do it correctly? thnx Frank <?php session_start(); if (!empty($_POST)){ // eventueel nog meer validatie, nu even ervan uitgaan dat // gegevens correct zijn aangeleverd via het formulier $voornaam= $_POST["voornaam"]; $naam= $_POST["naam"]; $adres= $_POST["adres"]; $huisn = $_POST["huisn"]; $pcode= $_POST["pcode"]; $gemeente = $_POST["gemeente"]; $tel= $_POST["tel"]; $email = $_POST["email"]; session_register("voornaam"); session_register("naam"); session_register("adres"); session_register("huisn"); session_register("pcode"); session_register("gemeente"); session_register("tel"); session_register("email"); // Of korter genoteerd: // doorsturen naar pagina header("Location: vervolgformulier.php"); } ?> <link rel="stylesheet" href="cfy.css"> <body> <form name="ditformulier.php" method="post" action="<?php echo($_SERVER["PHP_SELF"]);?>"> <center> <TABLE> <H1>Uw gegevens</H1></TABLE> <table> <tr align="left"> <TD> <P>Voornaam:</P></TD> <TD><INPUT name=voornaam maxsize="50"></TD></TR> <tr align="left"> <TD> <P>Naam: </P></TD> <TD><INPUT name=naam maxsize="50"></TD></TR> <tr align="left"> <TD>Adres:</TD> <TD><INPUT name=adres maxsize="50"></TD></TR> <tr align="left"> <TD>Huisnummer:</TD> <TD><input name=huisn type=text MAXLENGTH="7" SIZE="7"></td></TR> <tr align="left"> <TD>Postcode</TD> <TD><INPUT title="Your Google Toolbar can fill this in for you. Select AutoFill" style="BACKGROUND-COLOR: #ffffa0" name=pcode maxlength="7"size="7"></TD></TR> <tr align="left"> <TD>Gemeente:</TD> <TD><SELECT size=1 name=gemeente><OPTION value=-1 selected ?selected?><OPTION value="Aalten">Aalten</OPTION> <OPTION value="Apeldoorn">Apeldoorn</OPTION> <OPTION vvalue="Barneveld">Barneveld</OPTION> <OPTION value="Berkelland">Berkelland</OPTION> <OPTION </SELECT></TD></TR> <tr align="left"> <TD>Telefoon:</TD> <TD><INPUT name=tel maxsize="50"></TD></TR> <tr align="left"> <TD>Email:</TD> <TD><INPUT title="Your Google Toolbar can fill this in for you. Select AutoFill" style="BACKGROUND-COLOR: #ffffa0" name=email maxsize="50"></TD></TR> </table> <INPUT type=submit value="verstuur formulier" name=submit> </FORM> </center> </body> Link to comment https://forums.phpfreaks.com/topic/37202-redirecting-first-part-of-a-form-to-anotherpage-and-a-follow-up-form/ Share on other sites More sharing options...
Xinil Posted February 5, 2007 Share Posted February 5, 2007 Store the first part of the form in hidden form fields. For example, if your first form has name="first_name" and name="last_name". Then you submit this form to go to the second one...now you'd have name="mysecondform", and name="mysecondform_option2" WITH name="first_name" type="hidden", and name="last_name" type="hidden" Now you can just submit through Post again without any problems. Link to comment https://forums.phpfreaks.com/topic/37202-redirecting-first-part-of-a-form-to-anotherpage-and-a-follow-up-form/#findComment-177783 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.