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.
DD (01-31)
MM (01-12)
YYYY (2005 - 2010)
How do I get these to default to the current date?
> Brain function today is almost zero!
Like any other day then :)
> Now does that refer to the value of the id or the name?
The name attribute, the ID attribute isn't parsed by web browsers like the name attribute is.
> If I change my form to:
>
>
PHP won't create the variable day within the $_POST superglobal in this case. As Grain said below, replace $_POST['day'] with $_POST['FirstSelectDay'].
> code:
> if (isset($_POST['Day'])) $Day =
> htmlentities(trim($_POST['Day'])); if (empty($Day))
> $Day = "not specified";
Then just change references of $_POST['Day'] to $_POST['FirstSelectDay'] and you should be fine.
> Tyla wrote:
> Will the PHP still pick up thwe value for $Day or do I need to amend
> it to $FirstSelectDay?
>
> Without seeing any code, I'd say yes.
>
> Btw, the pedants among us will be along shortly to tell you the evils
> of relying on registered globals in PHP (by that I mean having php
> create variables automatically based on GET/POST which seems to be
> the case here). :)
code:
if (isset($_POST['Day'])) $Day = htmlentities(trim($_POST['Day'])); if (empty($Day)) $Day = "not specified";
> monkey_man wrote:
> Actually, you're quite right. Bah, I confused it with something I'm
> making that uses the amount of days in a month. I'll edit.
>
> I see, did you realise that the date function can be used to tell you
> the number of days in a month? Preferable to 12 if statements I
> think.
Yeah, I cast my beady eye over PHP.net a while back and it does all sorts of things like Gregorian calenders, and stuff like that. I just used the "Jan", "Feb", etc so I could echo that, kinda moved on and didn't go back to it.
> Will the PHP still pick up thwe value for $Day or do I need to amend
> it to $FirstSelectDay?
Without seeing any code, I'd say yes.
Btw, the pedants among us will be along shortly to tell you the evils of relying on registered globals in PHP (by that I mean having php create variables automatically based on GET/POST which seems to be the case here). :)
My form uses:
> Actually, you're quite right. Bah, I confused it with something I'm
> making that uses the amount of days in a month. I'll edit.
I see, did you realise that the date function can be used to tell you the number of days in a month? Preferable to 12 if statements I think.
> 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.
Actually, you're quite right. Bah, I confused it with something I'm making that uses the amount of days in a month. I'll edit.
> 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.
Ah ha, that may be a better solution for what I'm after. Cheers.