GetDotted Domains

Viewing Thread:
"Quick PHP question"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Tue 15/02/05 at 11:41
Regular
"l33t cs50r"
Posts: 2,956
Have a form with 3 drop downs for selecting a date:

DD (01-31)
MM (01-12)
YYYY (2005 - 2010)

How do I get these to default to the current date?
Tue 15/02/05 at 13:58
Regular
"NULL"
Posts: 1,384
Just use for() statements to make the dropdown lists, and have an "if today, then echo this, else echo this".
Tue 15/02/05 at 13:25
Regular
"Devil in disguise"
Posts: 3,151
monkey_man wrote:
> That'll do it. You'll have to repeat the IF statement for each month
> though, and I'm not sure how the leap year affects it. You can just
> put 29 I suppose, it doesn't matter.
>

Why would you need to repeat it for each month? In fact I don't even understand your reasoning for doing it once.
Tue 15/02/05 at 12:34
Regular
"Pouch Ape"
Posts: 14,499
That'll do it. You'll have to repeat the IF statement for each month though, and I'm not sure how the leap year affects it. You can just put 29 I suppose, it doesn't matter.

Might also need to add 1 to the $end in the WHILE statement, or it might stop one short - can't remember off the top of my head if it counts it or not. Hope it works/helps.
Tue 15/02/05 at 12:33
Regular
"Pouch Ape"
Posts: 14,499
$this_date = date("d");
$this_month = date("M");
$start = 1;

while($start < 31)
{

if($start == $this_date)
{ print(""); }
else
{ print(""); }

$start++;

}
Tue 15/02/05 at 12:27
Regular
"Pouch Ape"
Posts: 14,499
I'm making sometihng with date functions at the moment, and I've just used a series of IF statements. Big and not clever, but it works.
Tue 15/02/05 at 11:58
Moderator
"Are you sure?"
Posts: 5,000
I'm afraid I don't have a PHP answer - this is the javascript that I use [URL]http://javascript.internet.com/forms/true-date-selector.html[/URL]

It also validates the date - i.e. won't accept an illegal date.
Tue 15/02/05 at 11:41
Regular
"l33t cs50r"
Posts: 2,956
Have a form with 3 drop downs for selecting a date:

DD (01-31)
MM (01-12)
YYYY (2005 - 2010)

How do I get these to default to the current date?

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Just a quick note to say thanks for a very good service ... in fact excellent service..
I am very happy with your customer service and speed and quality of my broadband connection .. keep up the good work . and a good new year to all of you at freeola.
Matthew Bradley
Excellent support service!
I have always found the support staff to provide an excellent service on every occasion I've called.
Ben

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.