Jump to content


Photo

place forms in dropdown


  • Please log in to reply
4 replies to this topic

#1 bagnallc

bagnallc
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 21 September 2006 - 09:14 AM

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




#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 21 September 2006 - 09:28 AM

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?
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 bagnallc

bagnallc
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 21 September 2006 - 10:00 AM

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 }






#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 21 September 2006 - 10:44 AM

As I said, the only way I can think of is something like this
<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>  

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#5 bagnallc

bagnallc
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 21 September 2006 - 10:51 AM

that is extremely helpful and very good of you to take the time.

i will give it a go now.

many thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users