|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
nilesh005600 Smarty n00b
Joined: 05 Mar 2013 Posts: 1
|
Posted: Tue Mar 05, 2013 5:05 am Post subject: want to retain the value in drop down list after submit |
|
|
hello all,
I have to retain the selected value in drop down list after submit. I have done it in simple PHP , but not able to convert it into smarty. Please help me to convert it to smarty.
My code is as below...
<?php
//$year = 2011;
$selectedYear = isset($_POST['year_nam']) ? $_POST['year_nam'] : $year;
?>
<select name="year_nam" id="year_nam">
<?php
for ($yr_nam = 1920; $yr_nam <= 2013; $yr_nam++)
{
$selected = ($selectedYear == $yr_nam ) ? ' selected="selected"' : "";
echo "<option value='$yr_nam' $selected>$yr_nam</option>";
}
?>
</select> |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|