Jump to content

select box date cheers


redarrow

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]
Link to comment
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]
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.