0

I want make list years in PHP.List contains years of 1900 to 1992. Second problem is send my list to another
adress in GET metods.

4
Contributors
6
Replies
32
Views
3 Years
Discussion Span
Last Post by Webville312
1
$list = implode(",",range(1900,1992));
echo "<a href='http://www.example.com?list=$list'>Send List</a>";

Perhaps you'd find a form easier?
Maybe also to urlencode the list before inserting

Edited by diafol

0

Thanks.But I need drop-down list.In HTML this is <select><option>.It
isn't recommended for a long list.

Best regards

0

You did not ask for that originally.

0

Hi,

Next time, state your questions as clearly as possible. We can simply write codes like this.

<?php

$min_year = 1900;
$max_year = 1992;

echo '<form>';
echo '<select name="year">';
foreach (range($max_year, $min_year, -1) as $x) {

    echo '<option value="'.$x.'">'.$x.'</option>';

    }
echo '</select>';
echo '</br>';    
echo '<input type="submit" value="submit"/>';    
echo '</form>';  

-1 reverses the count from max_year to min_year. If you want 1900 to be the first on the option, then you can switch the position of the max_year and the min_year and then declare the step parameter to 1 , instead of -1.

Edited by veedeoo: info added.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.