Time dropdown in PHP


<select name=”Monday_start”><?php  $time = ’10:00′; // start ?>
<option value=””>Select time here</option>
<?php for ($i = 0; $i <= 20; $i++)
{
$prev = date(‘g:i a’, strtotime($time)); // format the start time
$next = strtotime(‘+30mins’, strtotime($time)); // add 30 mins
$time = date(‘g:i a’, $next); // format the next time ?>
<option value=”<?php echo $prev; ?>”><?php echo $prev; ?></option>
<?php } ?>
</select>
Change date format
$date = '19:24:15 06/13/2013'; 
echo date('h:i:s a m/d/Y', strtotime($date));$date = '19:24:15 06/13/2013';
echo date('h:i:s a m/d/Y', strtotime($date));
HTML elements like “bold”, “italic” etc on textarea using HTML with java script.
<form action=”” name=”myForm” method=”post”>
[&nbsp;<span class=”intLink” onclick=”insertMetachars(‘&lt;strong&gt;’,’&lt;\/strong&gt;’);”><strong>B</strong></span> | <span class=”intLink” onclick=”insertMetachars(‘&lt;em&gt;’,’&lt;\/em&gt;’);”><em>I</em></span> | <span class=”intLink” onclick=”var newURL=prompt(‘Enter the full URL for the link’);if(newURL){insertMetachars(‘&lt;a href=\u0022’+newURL+’\u0022&gt;’,’&lt;\/a&gt;’);}else{document.myForm.new_subspecify.focus();}”>URL</span>]<br>
<input type=”text” id=”doct_specialty” value=”” name=”new_subspecify”><br>
<input type=”submit” value=”Save” id=”butt_specialty” name=”hosp_services”>
</form>
<script>
function insertMetachars(sStartTag, sEndTag) {
var bDouble = arguments.length > 1, oMsgInput = document.myForm.new_subspecify, nSelStart = oMsgInput.selectionStart, nSelEnd = oMsgInput.selectionEnd, sOldText = oMsgInput.value;
oMsgInput.value = sOldText.substring(0, nSelStart) + (bDouble ? sStartTag + sOldText.substring(nSelStart, nSelEnd) + sEndTag : sStartTag) + sOldText.substring(nSelEnd);
oMsgInput.setSelectionRange(bDouble || nSelStart === nSelEnd ? nSelStart + sStartTag.length : nSelStart, (bDouble ? nSelEnd : nSelStart) + sStartTag.length);
oMsgInput.focus();
}
</script>
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s