Jump to content

Archived

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

bagnallc

place forms in dropdown

Recommended Posts

hi there

at the moment i currently have a lot of forms which dependent on the users selection take you to a different page on my website (carrying forward some variables as they go)

Id like to place them all in one dropdown with one go button. Is this possible?

thanks


Share this post


Link to post
Share on other sites
You could put a menu of form names in a dropdown, then, when the user selects a particular form, display that form for the user to complete.

Is that what you mean?

Share this post


Link to post
Share on other sites
hi thanks for reply.

i will show some code and maybe that will help

the following forms are among those currently on the page. as you will see each has its own go button and only displays depending on whether a variable is set

basically i would like to get these into a dropdown with one go button which then takes you to the relevant page.

//include the UK/IRE option if not set or the unset option if it is
if(isset($countryid)) { ?>
<form name="unsetcountryform" action="wizardunset.php" method="get">
<input type="hidden" name="unsetcountry" value="<?php echo $countryid ?>">
<?php include("hidden_fields_for_separate_forms.php"); ?>
<input type="submit" value="UNSET"> </form>
<?php } else { ?>
<form name="gotocountryform" action="country_form.php" method="get">
<?php include("hidden_fields_for_separate_forms.php"); ?>
<input type="submit" value="SET"> </form>
<?php }
//end of uk/ire set/unset options start of QS
echo "</td><td width=8%>";
if(isset($countryid)) { echo "Information already Set"; } else { ?>
<form name="gotoQScountryform" action="quicksetcountry.php" method="get">
<?php include("hidden_fields_for_separate_forms.php"); ?>
<input type="submit" value="QS"> </form>
<?php }




Share this post


Link to post
Share on other sites
As I said, the only way I can think of is something like this
[code]
<html>
<head>
<meta name="generator" content="PhpED Version 4.5 (Build 4513)">
<title>Multi form sample</title>
<meta name="author" content="Barand">
<SCRIPT language='javascript'>
        var currentFormID = '';

        function showHideForm (formid) {
            if (currentFormID != '') {
                var theForm = document.getElementById(currentFormID);
                theForm.style.visibility = 'Hidden';
            }
            if (formid != '') {
                theForm = document.getElementById(formid);
                theForm.style.visibility = 'Visible';
            }
            currentFormID = formid;
        }
</SCRIPT>
<STYLE content='text/css'>
DIV.form {
    width: 500px;
    border: 1px solid gray;
    visibility: hidden;
    position: absolute;
    top: 100;
    left: 0;
}
#unsetcountryform {
    background-color: #D9FFFF;
}
#gotocountryform {
    background-color: #ECE4B9;
}
#gotoQScountryform {
    background-color: #FFFFC0;
}
</STYLE>
</head>
<body>
<select name="formid" onchange="showHideForm(this.value);">
  <option value="">- choose form -</option>
  <option value="unsetcountryform">Unset Country</option>
  <option value="gotocountryform">Set Country</option>
  <option value="gotoQScountryform">Go To QS Country</option>
</select>
<HR/>
<DIV>
    <DIV class='form' id="unsetcountryform">
        <form name="unsetcountryform" action="wizardunset.php" method="get">
        <input type="hidden" name="unsetcountry" value="<?php echo $countryid ?>">
        <?php include("hidden_fields_for_separate_forms.php"); ?>
        <input type="submit" value="UNSET"> </form>
    </DIV>

    <DIV class='form' id="gotocountryform">
        <form name="gotocountryform" action="country_form.php" method="get">
        <?php include("hidden_fields_for_separate_forms.php"); ?>
        <input type="submit" value="SET"> </form>
    </DIV>

    <DIV class='form' id="gotoQScountryform">
        <?php //end of uk/ire set/unset options start of QS
        echo "</td><td width=8%>";
        if(isset($countryid)) { echo "Information already Set"; } else { ?>
        <form name="gotoQScountryform" action="quicksetcountry.php" method="get">
        <?php include("hidden_fields_for_separate_forms.php"); ?>
        <input type="submit" value="QS"> </form>
        <?php } ?>
    </DIV>
</DIV>

</body>
</html> 
[/code]

Share this post


Link to post
Share on other sites

×

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.