Jump to content

Archived

This topic is now archived and is closed to further replies.

redarrow

select box date cheers

Recommended Posts

this code shows 4 dates in a select box, I need to know how to get the select box to start fom a 00-00-00 then show the first date month year .

so if a user has only two dates to select the daefult last two dates are 00-00-00 but under the 00-00-00 you get the same affect as it is know.

[code]
<form method="POST" action="test.php">
<?
for ($i=1;$i<5;$i++){
?>
Day<?=$i?>:
<select name="day<?=$i?>">
<?
for($days=01;$days<32;$days++){
?>
<option value="<?=$days?>">Day <?=$days?></option>';
<?
}
?>
</select>
<select name="month<?=$i?>">
<?
for ($months=1;$months<13;$months++){
?>
<option value="<?=$months?>" <? if($months == $month){ echo "selected";} ?>>Month <?=$months?></option>';
<?
}
?>
</select>
<select name="year<?=$i?>">
<?
for($years=2006; $years<2010;$years++){
?>
<option value="<?=$years?>" <? if($years == $year){ echo "selected";}?>>Year <?=$years?></option>
<?
}
?>
</select>
<br />
<?
}
?>
[/code]

Share this post


Link to post
Share on other sites
You might want to start by telling us what it does now and what you want it to do. Provide sample outputs. Your question is confusing.

Share this post


Link to post
Share on other sites
in the database i got these varables

[code]
$dates1
$dates2
$dates3
$dates4

date format is day month year ("d-m-y")
[/code]


if the user updates there code i get the defult values of dates.

i need to get the users varables from the database and get them in the select box so that they no what they got know and what to chage to.

<? echo $row["dates1"]?> ect.......<<<<<<<<< need somthink like this added cheers.


[code]
<form method="POST" action="test.php">

<?
for ($i=1;$i<5;$i++){
?>
Day<?=$i?>:
<select name="day<?=$i?>">
<?
for($days=01;$days<32;$days++){
?>
<option value="<?=$days?>">Day <?=$days?></option>';
<?
}
?>
</select>
<select name="month<?=$i?>">
<?
for ($months=1;$months<13;$months++){
?>
<option value="<?=$months?>" <? if($months == $month){ echo "selected";} ?>>Month <?=$months?></option>';
<?
}
?>
</select>
<select name="year<?=$i?>">
<?
for($years=2006; $years<2010;$years++){
?>
<option value="<?=$years?>" <? if($years == $year){ echo "selected";}?>>Year <?=$years?></option>
<?
}
?>
</select>
<br />
<?
}
?>
[/code]

Share this post


Link to post
Share on other sites

×

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.