Multiple Page Forms
So you have this long, involved form. Rather than present the user with a myriad of inputs on a single page, you want to break this up into separate form pages. So now you’re asking, „How do you make multiple page forms?” I’m glad you asked. It’s easy!
Here’s one easy way. Consider the following small bit of code, which assumes that your form is submitted via the POST method:
foreach($_POST as $key=>$value){
if ($key!=”submit”){
$value=htmlentities(stripslashes(strip_tags($value)));
echo „t
„;
}
}
?>
What’s that bit of code do? If you were to place the above code between your opening
tag, it will look at all values received from the prior page, strips out any HTML tags, replaces any character entities with their appropriate code and writes them to hidden inputs in the current form. It will skip a value of „submit” so it won’t duplicate your submit button. If you name your submit button something other than „submit”, you should change that bit in the code.
Here is a simple form that you can try out. First, look at the source code of this page. In particular, look at the
Parašykite komentarą