1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. To combat forum spam, we are temporarily disabling the ability to create new accounts for the forums. Please feel free to open a support ticket through out client area with any support issues. You can also search the forums for answers to many questions.

Dynamic Listing dropdown

Discussion in 'Customizations (Themes / Templates)' started by bangonthedrum, Dec 18, 2005.

Thread Status:
Not open for further replies.
  1. bangonthedrum

    bangonthedrum New Member

    Hey, I created a dynamic form to display on your page to use the List module to have an easy archive of years:
    (i tried making this code generic, hopefully i didn't mess it up in the process..also, this is for version 5.7)

    Code:
     
    <?php
    $nextyear = date("Y")+1;
    //show curent year when landing on page
    if(!$_POST["posted"]){
    $thedate = date("Y");
    $LIST=1;
    $listYear = $thedate;
    $DF = "m/d/y";
    $template="templatefile.php";
    //Show Form 1 before selecting
    print '<div align="right">';
    print '<form name="dates" method="post" action="thepagethathasthiscode.php">';
    printf("Archive:&nbsp;<select name=\"calyear\">");
    printf("<option value=\"\">%s</option>", 'Year');
     for($i = $nextyear; $i > 2000; $i--){
        $selected = $_POST["calyear"];
        printf("<option value=\"%s\" %s>%s</option>", $i, $selected, $i);
      }
    printf("</select>");
    print '<input type="hidden" name="posted" value="1"/>';
    print '&nbsp;&nbsp;<input style="background-color:#ffffff" type="submit" value="submit" name="submitme"  />';
    print '</form>';
    print '</div>';
    require ("escal/showCalendar.php");
    }
    if($_POST["posted"]){
    //show form 2 after selecting
    print '<form name="dates" method="post" action="thepagethathasthiscode.php">';
    print '<div align="right">';
    printf("Archive:&nbsp;<select name=\"calyear\">");
    printf("<option value=\"\">%s</option>", $_POST["calyear"]);
     for($i = $nextyear; $i > 2000; $i--){
        $selected = $_POST["calyear"];
          printf("<option value=\"%s\" %s>%s</option>", $i, $selected, $i);
     
    }
    printf("</select>");
    print '<input type="hidden" name="posted" value="1"/>';
    print '&nbsp;&nbsp;<input style="background-color:#ffffff" type="submit" value="submit" name="submitme"  />';
    print '</form>';
    print '</div>';
    $thedate = $_POST["calyear"];
    $LIST=1;
    $listYear = $thedate;
    $DF = "m/d/y";
    $template="templatefile.php";
    require ("escal/showCalendar.php");
    }
     
    ?>
    
     
Thread Status:
Not open for further replies.

Share This Page