PHP / JS - Pop up Calendar (date picker)

Small, short code snippets that other people may find useful. Do you have a good regex that you would like to share? Share it! Even better, the code can be commented on, and improved.

Moderator: General Moderators

User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

ichversuchte wrote:Im sorry, but i am just starting out with php, what I gathered from your post was that i changed it from <? to <?php and didn't update the single = sign to == ... such as the below, but if thats the case i get this error?
Try something like this to see if it helps...

Code: Select all

<option value="1" <?php echo ($mo == "1") ? "selected="selected"" : ""; ?>>January</option>
<option value="2" <?php echo ($mo == "2") ? "selected="selected"" : ""; ?>>February</option>
<option value="3" <?php echo ($mo == "3") ? "selected="selected"" : ""; ?>>March</option>
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

Code: Select all

<option value="1" <?php echo ($mo == "1") ? '"selected="selected"' : ""; ?>>January</option>
<option value="2" <?php echo ($mo == "2") ? '"selected="selected"' : ""; ?>>February</option>
<option value="3" <?php echo ($mo == "3") ? '"selected="selected"' : ""; ?>>March</option>
without the parse erorrs
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

HA! Thanks shiz. Posting at 1:00 in the morning can be dangerous to folks needing help, huh? Sheesh, I didn't even see that.
wexter
Forum Newbie
Posts: 1
Joined: Sun Apr 16, 2006 1:55 pm

Drop Down Box

Post by wexter »

hi,
was searching for some thing like this its nice and working well for me but how i can get the date in separate drop down boxes instead of one "text box" means a separate drop down for "day" another dropdown for month and leave the "year " hidden i want to display only date and month in separate drop down boxes.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Search around a bit. There are plenty of implementations of calendar selectors like this.
Post Reply