...

View Full Version : Enable/disable a radio button for certain hour



lovelytoday
10-30-2009, 03:56 AM
Hi,

I am working on php coding and have no idea how to Enable/disable a radio button for certain hour.

Here is code for a radio button.


<?php if ($delivery_date_time == "1") { ?>
<input type="radio" name="delivery_date_time" id="delivery_date_time_input" value="1" checked/>
<?php } else {?>
<input type="radio" name="delivery_date_time" id="delivery_date_time_input" value="1"/>
<?php }
echo $VM_LANG->_('PHPSHOP_CHECKOUT_DELIVERY_DATE_TIME1') ?><br/>


I want to enable this code from 0 to 6 am and disable the other hour in every day.

Thank you for your help!

Isaac.

Fou-Lu
10-30-2009, 04:10 AM
What is $delivery_date_time? Can you post where that is declared?

oesxyl
10-30-2009, 04:16 AM
<?php
function edt(){
$now = localtime(time(),true);
$hour = $now['tm_hour'];
if($hour >= 0 && $hour <= 6){
return 'checked="checked"';
}
return '';
}
?>
<input type="radio" name="delivery_date_time" id="delivery_date_time_input"
value="1"<?php echo edt(); ?>/>


best regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum