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 4061150
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:25:49+00:00 2026-05-20T15:25:49+00:00

I have I have two pages. One with the select boxes on and the

  • 0

I have I have two pages. One with the select boxes on and the send button. When the user chooses their options from the select boxes and clicks send it takes them to the second page which outputs their choices.

date_change.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Loughborough University | Students Union</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />

</head>

<body>
<?php
$day = array(range(1,31));
$month = array(range(1,12));
$year = array(range(2011,2020));
print_r($day);


?>
<form action="test.php" method="post">
Day:
<select name="day">
  <?php foreach($day[0]++ as $key => $value) { ?>
    <option value="<?php echo $key ?>" ><?php echo $value ?></option>
  <?php }?>
</select>
<br>
Month:
<select name="month">
  <?php foreach($month[0]++ as $key => $value) { ?>
    <option value="<?php echo $key ?>" ><?php echo $value ?></option>
  <?php }?>
</select>
<br>
Year:
<select name="year">
  <?php foreach($year[0]++ as $key => $value) { ?>
    <option value="<?php echo $key ?>" ><?php echo $value ?></option>
  <?php }?>
</select>
<input type='submit' value='send' name='send' />
</form>


</body>
</html>

and test.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Loughborough University | Students Union</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />

</head>

<body>

<?php   
$day = $_POST["day"];
$month = $_POST["month"];
$year = $_POST["year"];

echo $day;
echo $month;
echo $year;
?>

Date Selected: <?php echo $_POST["day"];echo $_POST["month"];echo $_POST["year"]; ?>

</body>
</html>

However, say for example i choose, day 1, month 1, and year 2011 it comes out with 000. Why is this and what can i do to correct this?

Thanks for any ideas or suggestions.

  • 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-05-20T15:25:49+00:00Added an answer on May 20, 2026 at 3:25 pm

    In every option you have to use $value instead of $key:

    <option value="<?php echo $value ?>" >
    

    Because you pass to inputs just keys, not values.

    For example:

    $year = array(range(2011,2020));
    

    creates an array:

    array(
      0 => 2011,
      1 => 2012,
      2 => 2013,
      3 => 2014,
      4 => 2015,
      5 => 2016,
      6 => 2017,
      ...
    )
    

    so if you select 2014:

    <option value="<?php echo $key ?>" ><?php echo $value ?></option>
    

    is equals to

    <option value="3">2014</option>
    

    And in your posted test.php page you will get 3 as a year.

    So simply change as I descriped on the beggining will solve your problem.

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

Sidebar

Related Questions

I have two pages. One with the select boxes on and the send button.
I have two select boxes (one for Car Types and the other for Car
We have some web pages which have two frames, with one frame in the
I have two forms on one page and want to have the input boxes
I have two pages, NonMember.aspx and Member.aspx. If a user comes to the site,
I have two text boxes (select) which I want to change the contents of
I currently have two tables, one for pages (objects) and one for images (media).
I have two pages, one posts value to another, then it makes a mysql
I have two models, one is for pages and one is for authors. I
I have two tables (subjects and pages) in one-to-many relations. I want to add

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.