Jump to content

Form automatic fill space between Years


dani33l_87
Go to solution Solved by davidannis,

Recommended Posts

I have this form:

 

 
Start Year:
<select name="start"><option value="" selected="selected"></option>
<option value="1991">1991</option><option value="1992">1992</option><option value="1993">1993</option><option value="1994">1994</option></selected.
 
to:
<select name="end"><option value="" selected="selected"></option>
<option value="2015">2015</option><option value="2014">2014</option><option value="2013">2013</option><option value="2012">2012</option>
<option value="2001">2001</option><option value="2010">2010</option></select>
 
 
$start = $_GET['start'];     // value="1994"
$end = $_GET['end'];      // value="2001"            
 
//the value can change
 
 
How can I get all the years between 1994-2010 + some text
 
$years= T1994YearT1995YearT1996YearT1997YearT1998YearT1999YearT2000YearT2001Year
 
 
 
 
Link to comment
Share on other sites

I don't know what you are really asking, but would something like this work?

<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<title>Birthdate</title>
	<style>
		.formStyle {
			margin-left: 200px;
		}
	</style>
</head>

<body>
	<form class="formStyle" action="theYears.php" method="post">
		<select id="yearBorn" name="yearBorn">
			<option selected>Date of Birth</option>
			<?php
			$year = 1914;
			for (  $x = 1; $x <= 101; $x++ ) {					
				echo '<option value="' . $year . '">' . $year . '</option>';
				$year += 1;
			}
			?>
			<input type="submit" name="submit" value="Submit">
		</select>
	</form>
</body>
</html>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.