Jump to content

Multiple Page Form


Kathy_OC

Recommended Posts

I'm working on a project that involves a multiple page form.  One of the pages has 5 checkboxes and depending on which boxes are checked, determines the next page(s) of the form that will be displayed.  In other words, if the user checks boxes 1, 2 and 4 then the pages associated with those three checkboxes should be displayed.  If the user checks box 5, then the page associated with that checkbox should be displayed.  The checkbox values are being saved to a database.

 

I'm not very experienced with PHP and I'm feeling a bit lost as far as how to implement this.  I think I could come up with a cumbersome way to do it, but I'm hoping for some advice about the best way to do this.  Do you have suggestions?

 

Thanks,

Kathy

 

Link to comment
https://forums.phpfreaks.com/topic/109577-multiple-page-form/
Share on other sites

Whatever is easier for you is the best way.(Unless you create a security hole)

 

I would create the forms in separate files like so: form1.inc.php, form2.inc.php.  The form files should only contain a single form and nothing else.  For example form1.inc.php should only have <form id="form1" method="post or get" action="whatever.php"> ..............</form>

 

And in the page that displays these should check the database to see which form should be displayed and include that form like so:

<Doctype and headers....>

<body>

<?php

if(database says form1) {

  require_once("form1.inc.php");

}

else {

  require_once("form2.inc.php");

}

?>

Link to comment
https://forums.phpfreaks.com/topic/109577-multiple-page-form/#findComment-562075
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.