View Full Version : Date Text Field

Richard Diedrick
08-24-2010, 02:12 PM
I am sure that this is a simple thing but I cannot seem to understand all of the available code. What I need are 2 ways to populate a text field on a form with a date that will record in an sql database. Tha database seems to only accept a date if it is formated 0000-00-00 (year,month,day). Don't mind that but would prefer the text field to display 12 Aug 2010 type format but still be able to update the database.

1. Have a text field in a form that is attached to a database field need to insert the current date into the text field if there is no value in the database and update the database with that date, if there is a value currently in the database then do nothing. This would happen on the click event.
2. I have tried several data pickers that are offered but none will work with Php pages that is using a form to update records. Don't mind buying a widget bas long as it will work using CS4.

Any help will be greatly appreciated.

08-24-2010, 02:22 PM
Have a look at; http://jqueryui.com/demos/datepicker/ It is free, nice looking and you can format the date format.

You will need to match the date format through your SQL in order to put it in the database I believe.

08-25-2010, 01:24 AM
its all about formating really. date( d/M/Y) will display as you want but it will need to match formating of the database to insert it.

if you want the current date then i would look at the insert script to check if the field is empty first.
in this case you wouldnt need a date picker .

08-25-2010, 01:25 AM
thisa is a good source of php tuts and help with dates http://www.tizag.com/phpT/phpdate.php

Richard Diedrick
08-25-2010, 06:21 AM
Thanks to all for mthe help will foolow the links and see if I can learn!!:)