Re: How should I ....--its a date/timestamp issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
> > > What are your suggestions folks on how to go about setting a date on a
> form
> > > so that a user can not set a start date prior to the current days date?
> > > I've been looking around php.net but is it a javascript thing in the
> > > validation I should be dealing with, basically as it is I have a form
> and a
> > > user can select a start date, but they should not be able to select a
> date
> > > that is past, currently the start date form is a drop down (a very long
> drop
> > > down) I would like to use one of those nifty calendar popups but am not
> sure
> > > (aka..wasn't able to figure out) how to send the date to the db fields
> as
> > > they are...
> > > guidance on this would be great ..how would you do it?
> > > thanks guys and gals
> > > Terion
> >
> > Broadly, you're either going to have to limit their choices going in to
> > the form (limit the choices in the drop-down box), or validate it
> > afterwards and generate an error message if it's wrong.
> >
> > I've never seen one of those calendar gizmos that wasn't Javascript,
> > except maybe for Ashley's (mentioned in another thread). And even at
> > that, a PHP one won't be selectable the way you want unless you put
> > radio buttons next to all the dates. And after all that, you'd still
> > have to do some pre-processing of it to limit selections to current date
> > and later.
> >
> > Paul
> >
> > --
> > Paul M. Foster
> >
> What about just accepting any date in to the system, and defaulting to
> the current date if any numptys/users try to set one before?
>
> Do something maybe like this (untested)
>
> $userDate = strtotime($_REQUEST['date']);
> $startDate = ($userDate < time())?time():$userDate;
>
> >From there, you can use the timestamp how you wish.
>
>
> OOH found it:
>
> $startday  = mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"));
>
>
> Well no, guess I didn't find it because that code above gives me
> this 1235109600
>
> What is that??

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux