dani33l_87 Posted July 6, 2014 Share Posted July 6, 2014 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 Quote Link to comment Share on other sites More sharing options...
Miggy64 Posted July 6, 2014 Share Posted July 6, 2014 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> Quote Link to comment Share on other sites More sharing options...
Solution davidannis Posted July 6, 2014 Solution Share Posted July 6, 2014 I think what you want is: $start = $_GET['start']; // value="1994" $end = $_GET['end']; for ($x=$start ; $x<=$end; $x++){ $years .= 'T'.$x.'Year' ; } Quote Link to comment Share on other sites More sharing options...
dani33l_87 Posted July 8, 2014 Author Share Posted July 8, 2014 Yes this is perfect, thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.