Jump to content

creating multiple forms


barefootedboy

Recommended Posts

Hi there , i wonder if someone can help or point me in the right direction (A tutorial or something )

I am a newbe and what i am trying to  do is create a form that start off with a number of options (3)  depending on what the user chooses this will lead them to  another , more comprehensive form , i am trying to  avoid having one long form  that will put people off ... rather allowing them to  to go directly to the form that is relevant to  them , i have already created these forms i just need to  know how to  make the initial form ( the php for this )  I am as i said a novice  so if somebody knows of a tutorial in this direction that would be great .. i am aware that there may be a very easy answer to  this so please feel free to  laugh at me  should you feel the urge

 

kind regards

 

Sebastian 

Link to comment
https://forums.phpfreaks.com/topic/77986-creating-multiple-forms/
Share on other sites

You could use a dropdown list and let the user select a choice, and then direct them to the specified page.

<select>
<option onclick="javascript:document.location = 'relavant_page1.php'">Option 1</option>
<option onclick="javascript:document.location = 'relavant_page2.php'">Option 2</option>
<option onclick="javascript:document.location = 'relavant_page3.php'">Option 3</option>
</select>

 

Edit: Something as javascript can be used to display the form on the same page.

<script language="javascript">
function show(id,select) {
document.getElementById(select).style.display = "none";
document.getElementById(id).style.display = "block";
}
</script>

<select id="select">
<option onclick="javascript:show('one','select')">Option 1</option>
<option onclick="javascript:show('two','select')">Option 2</option>
<option onclick="javascript:show('three','select')">Option 3</option>
</select>

<div id="one" style="display:none">Form One</div>
<div id="two" style="display:none">Form Two</div>
<div id="three" style="display:none">Form Three</div>

wow thanks for these options , i think i am going to  try the first on as i already have the three forms on seperate  pages these are html pages that will post onto  a php page

thanks very much for giving me this option

 

kind regards

barefootedboy

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.