PHP checkbox with date value

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

karina1717
New php-forum User
New php-forum User
Posts: 3
Joined: Thu Nov 25, 2010 11:18 am

PHP checkbox with date value

Postby karina1717 » Thu May 02, 2013 12:21 pm

Hi everybody, I'm trying to create checkboxes that will have the value of today's date, tomorrows date, etc. These should, of course, update as the date changes through php. What would this look like using west coast time? Here is what it looks like now:

<input name="booked" type="checkbox" id="booked" value="the date should be updating to today's date" />

User avatar
sandeep605085
New php-forum User
New php-forum User
Posts: 44
Joined: Tue Feb 26, 2013 6:00 am
Location: Mindfire Solutions
Contact:

Re: PHP checkbox with date value

Postby sandeep605085 » Fri May 03, 2013 12:42 am

Hi,

It should be like
<input name="booked" type="checkbox" id="booked" value="<?php echo date('m/d/Y H:i:s'); ?>" />

Below is the reference for date function of php, you can check this to get the exact format of date you want it to be.
http://php.net/manual/en/function.date.php

Thanks,
Sandeep Agrawal
Mindfire Solutions


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest