popup calendar [SOLVED]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sabatier
Forum Newbie
Posts: 6
Joined: Thu Aug 23, 2007 5:40 am

popup calendar [SOLVED]

Post by sabatier »

Hi all, I'm new to php. Is it possible to implement a popup calendar in php where you can select a date and time without using javascript? Something along the lines of the ones shown here: http://www.softcomplex.com/products/tig ... demo1.html

If possible I want to be able to convert the input to the format "YYYY-MM-DDThh:mm:ss" (this is the dateTime data type used in XML schema).

Any help would be greatly appreciated,

Ruth
Last edited by sabatier on Thu Aug 23, 2007 6:14 am, edited 1 time in total.
Steve Mellor
Forum Commoner
Posts: 49
Joined: Thu Aug 02, 2007 8:18 am

Post by Steve Mellor »

I don't think there's any way of doing it purely in PHP. At some point you will need Javascript firstly to open the popup window and also if you want to update a form element dynamically. If you're using Javascript then you might as well use a Javascript calender. Take a look at the one at https://engineering.purdue.edu/ECN/Supp ... 0414131404 if you're after one which is easy to use and style.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Calendars can be produced quite easily using PHP. The difficulty is how does the user interact with it. PHP only updates things on the server side so the user would have to basically refresh the entire page every time they change something (change month/year etc and well as select the actual date). Javascript is on the client side and as a result uses the persons own browser to process what it needs without having to go to the server. To get the 'look and feel' of the calendar you pointed to, javascript is really the only solution.

For those people without javascript in this sort of instance it is important to add some text such as 'Format : dd/mm/yyyy' possibly using the <noscript> HTML tag. All validation of any form should be performed with php in the end anyway so you have a situation where those people who don't have javascript have the restriction of having to type a date. Those people with javascript have a nice popup.

As I use the jquery javascript anyway nowadays I would tend to use the Jquery DatePicker calendar.
Post Reply