Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9084323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:58:19+00:00 2026-06-16T20:58:19+00:00

I’m stuck on a little thing. I’ve got two select drop-down boxes inside one

  • 0

I’m stuck on a little thing.

I’ve got two select drop-down boxes inside one form.but now when I select the year and then the month I lose the selected year, I know why I lose the year. because I have set in the script onChange to javascript:document.location I’ve tried to put the $_GET['jaartal']; inside but it’s not working.

Can somebody please help me on this issue?

This is the script.

<?php   
    //Including config and connection file
    include_once '..\config\config.php';
    include_once '..\config\inc_connect.php';

    //Retrive month value from url and put in variable
    $maand = ViewDatumArray();

    //Retrive typ value from url and put in variable
    $verwerking = $_GET['type'];
    $vast_verwerking = $verwerking;

    // Years range setup
    //$kayako_start = 2012;

    ?>
  <!DOCTYPE html PUBLIC "XHTML 1.0 Transitional" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
      <script type="text/javascript" src="../config/function.js"></script>
      <link rel="stylesheet" href="../config/style.css" type="text/css">
  </head>
  <body style="background-color:#F8F4EB">
    <div style="width:900px; margin:0px auto;">
        <input type="button" value="Ga Terug" class="goBackJS" onClick="goBack()"/>
        <br/>
        <!-- 02-01-2013 Added function for year instead -->
        <span>Kies de Jaar / Maand van overzicht dat je wilt downloaden.</span>
            <form action="" method="post">
                <select class="dropstyle" name="jaartal" onChange"<?php $jaar_keuze = $jaar?>">
                    <option value="2012" selected>Kies jaartal</option>
                <?php // Generate the years from start kayako until now.
                    foreach (range($jaar_nummer = date("Y"), 2012) as $jaar) { ?>
                    <option value="<?php echo($jaar); ?>" selected><?php echo($jaar); ?></option>
                <?php
                } 
                ?>
                </select>
            </form>

            <?php echo $jaar_keuze; ?>
            <form action="" method="post">
                <select class="dropstyle" name="maand" onChange="javascript:document.location='class.View_Evident_Download.php?type=<?php echo $vast_verwerking; ?>&jaar=<?php $_GET['jaartal']; ?>&maand=' + this.value">
                <?php
                    foreach ($maand_teksten as $keyvalue => $waarde) { ?>
                    <option value="<?php echo $keyvalue; ?>"><?php echo $waarde;?></option>
                <?php 
                } 
                ?>
                </select>
            </form>
    <?php

                if(!empty($maand)){
                    $maand_gekozen = $maand[0]; 

        //Functies voor eerste en laatste dag van de maand
        $jaardag = eersteDagVanMaand();
        $jaareind = laatsteDagVanMaand();

    echo "<br/>";
    if ($maand_gekozen < "1"){
    echo "Kies maand om te downloaden.";
    } else {
        if(isset($_GET['type']))
        {
            $type_download = $_GET['type'];
            $jaar_nummer = $_GET['jaartal'];
            echo $type_contract[$type_download] . ' van <b>' . $maand_teksten[$maand_gekozen] . $jaar_keuze . '</b> staat klaar om gedownload te worden.<br/>';
            echo '<input style="width:300px;" type="button" onClick="location.href = \'class.Controller_Evident_Download.php?type=' . $type_download . '&maand=' . $maand_gekozen . '&jaar=' . $jaar_gekozen . '\';" class="goBackJS" value="Download ' . $type_contract[$type_download] . '"';
        };
    }
    echo "<br/>";
    echo "<br/>";
    }

    ?>
<br/>
</div>
 </body>
  </html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:58:21+00:00Added an answer on June 16, 2026 at 8:58 pm

    You should after form submit set selected option as selected by adding “selected” attribute to it instead of “2012” option like you do now. You can do it like this:

    <option <?php if($jaar==$_GET['jaartal']) print 'selected'; ?> value="<?php echo($jaar); ?>"><?php echo($jaar); ?></option>
    

    To use that you should remove “selected” attribute from “2012” option.
    EDIT: Your other problem is this that when doing page redirect you are trying to use form data but it is not available or not same as selected value. Instead of $_GET['jaartal'] you should use javascript code that takes currently selected year. Here are some tips how to do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tracked down a weird MySQL problem to the two different ways I was
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have a text area in my form which accepts all possible characters from
I'm trying to select an H1 element which is the second-child in its group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.