On Jan 15, 2008 2:38 PM, Richard Lynch <[EMAIL PROTECTED]> wrote:
> On Tue, January 15, 2008 12:31 pm, Adam Williams wrote:
> > Andrew Ballard wrote:
> > I don't see the point in needing to convert it to a timestamp. The
> > length_start and length_end fields in MySQL are defined as date
> > field
On Tue, January 15, 2008 12:31 pm, Adam Williams wrote:
> Andrew Ballard wrote:
> I don't see the point in needing to convert it to a timestamp. The
> length_start and length_end fields in MySQL are defined as date
> fields.
> All I care about is the date, not the hours/minutes/seconds. If I
> in
On Jan 15, 2008 2:24 PM, Andrew Ballard <[EMAIL PROTECTED]> wrote:
> On Jan 15, 2008 2:05 PM, Brady Mitchell <[EMAIL PROTECTED]> wrote:
> > > I'm having users enter dates in MM-DD- format. is there a way
> > > to check if what they have entered is invalid (like if they enter
> > > 1-15-2008 i
On Jan 15, 2008 2:05 PM, Brady Mitchell <[EMAIL PROTECTED]> wrote:
> > I'm having users enter dates in MM-DD- format. is there a way
> > to check if what they have entered is invalid (like if they enter
> > 1-15-2008 instead of 01-15-2008) ?
>
> Why not use something like http://www.dynarch.co
Andrew Ballard wrote:
All the more reason I would turn it into a timestamp or DateTime
object in PHP first. That will prevent trying to insert something like
what I used above. Then I would get rid of the MySQL STR_TO_DATE
function in the $mysqli_insert_sql value just replace it with
something li
On Jan 15, 2008 1:31 PM, Adam Williams <[EMAIL PROTECTED]> wrote:
> Andrew Ballard wrote:
> > All the more reason I would turn it into a timestamp or DateTime
> > object in PHP first. That will prevent trying to insert something like
> > what I used above. Then I would get rid of the MySQL STR_TO_D
I'm having users enter dates in MM-DD- format. is there a way
to check if what they have entered is invalid (like if they enter
1-15-2008 instead of 01-15-2008) ?
Why not use something like http://www.dynarch.com/projects/calendar/
to make it easier for the users? Along with being easi
On Jan 15, 2008 1:31 PM, Adam Williams <[EMAIL PROTECTED]> wrote:
> Andrew Ballard wrote:
> > All the more reason I would turn it into a timestamp or DateTime
> > object in PHP first. That will prevent trying to insert something like
> > what I used above. Then I would get rid of the MySQL STR_TO_
Adam Williams wrote:
I'm having users enter dates in MM-DD- format. is there a way to
check if what they have entered is invalid (like if they enter 1-15-2008
instead of 01-15-2008) ?
$utime = strtotime($_POST['input']);
if ( $utime !== false &&
$_POST['input'] == date('m-d-Y',
On Jan 15, 2008 11:51 AM, Adam Williams <[EMAIL PROTECTED]> wrote:
>
>
> Andrew Ballard wrote:
> > Just curious why you won't take 1-15-2008. Once you validate it, you
> > can always assign it to a variable as either a timestamp or a DateTime
> > object and then format it however you want when you
On Jan 15, 2008 11:51 AM, Adam Williams <[EMAIL PROTECTED]> wrote:
>
>
> Andrew Ballard wrote:
> > Just curious why you won't take 1-15-2008. Once you validate it, you
> > can always assign it to a variable as either a timestamp or a DateTime
> > object and then format it however you want when you
Andrew Ballard wrote:
Just curious why you won't take 1-15-2008. Once you validate it, you
can always assign it to a variable as either a timestamp or a DateTime
object and then format it however you want when you display it, send
it to a database, or whatever you are doing with the date.
FWIW
Adam Williams wrote:
> Thanks, I think I have it:
>
> $dateexplode = explode("-", $_POST["date_entered"]);
> if (!preg_match("/^(\d{2})$/", $dateexplode[0],$data1) ||
> !preg_match("/^(\d{2})$/", $dateexplode[1],$data2) ||
> !preg_match("/^(\d{4})$/", $dateexplode[2],$data3))
> {
>
On Jan 15, 2008 11:25 AM, Adam Williams <[EMAIL PROTECTED]> wrote:
> Thanks, I think I have it:
>
> $dateexplode = explode("-", $_POST["date_entered"]);
> if (!preg_match("/^(\d{2})$/", $dateexplode[0],$data1) ||
> !preg_match("/^(\d{2})$/", $dateexplode[1],$data2) ||
> !preg_match("/^(\d{4})$/", $
Thanks, I think I have it:
$dateexplode = explode("-", $_POST["date_entered"]);
if (!preg_match("/^(\d{2})$/", $dateexplode[0],$data1) ||
!preg_match("/^(\d{2})$/", $dateexplode[1],$data2) ||
!preg_match("/^(\d{4})$/", $dateexplode[2],$data3))
{
die ("you have entered an invalid dat
Daniel Brown wrote:
> By only doing JavaScript validation,
Just in case - I wasn't suggesting only doing javascript validation. I
think I said a simple javascript validation _followed_ (as in at
POST-time) by a semantic check. For which checkdate() seems pretty
optimal.
/Per Jessen, Züri
clive wrote:
> Adam Williams wrote:
>> I'm having users enter dates in MM-DD- format. is there a way to
>> check if what they have entered is invalid (like if they enter
>> 1-15-2008 instead of 01-15-2008) ?
>>
> explode() and checkdate() perhaps?
checkdate() sounds like just the thing.
/
On Jan 15, 2008 10:46 AM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Jan 15, 2008 10:38 AM, Richard Lynch <[EMAIL PROTECTED]> wrote:
> >
> >
> > On Tue, January 15, 2008 9:02 am, Per Jessen wrote:
> > > Nathan Nobbe wrote:
> > >
> > >> i think this ties into the thread tedd started a week or so
On Jan 15, 2008 9:27 AM, Adam Williams <[EMAIL PROTECTED]> wrote:
> I'm having users enter dates in MM-DD- format. is there a way to
> check if what they have entered is invalid (like if they enter 1-15-2008
> instead of 01-15-2008) ?
>
> --
> PHP General Mailing List (http://www.php.net/)
>
On Jan 15, 2008 10:38 AM, Richard Lynch <[EMAIL PROTECTED]> wrote:
>
>
> On Tue, January 15, 2008 9:02 am, Per Jessen wrote:
> > Nathan Nobbe wrote:
> >
> >> i think this ties into the thread tedd started a week or so ago
> >> about the best approach for collecting user data.
> >> it would be much
On Tue, January 15, 2008 9:02 am, Per Jessen wrote:
> Nathan Nobbe wrote:
>
>> i think this ties into the thread tedd started a week or so ago
>> about the best approach for collecting user data.
>> it would be much easier to validate if there were 3 text input
>> fields
>> to collect the data, r
On Tue, January 15, 2008 8:27 am, Adam Williams wrote:
> I'm having users enter dates in MM-DD- format. is there a way to
> check if what they have entered is invalid (like if they enter
> 1-15-2008
> instead of 01-15-2008) ?
Making the user type the 0 is just plain rude. :-)
You could use
Adam Williams wrote:
I'm having users enter dates in MM-DD- format. is there a way to
check if what they have entered is invalid (like if they enter
1-15-2008 instead of 01-15-2008) ?
explode() and checkdate() perhaps?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, vi
On Jan 15, 2008 10:02 AM, Per Jessen <[EMAIL PROTECTED]> wrote:
> Nathan Nobbe wrote:
>
> > i think this ties into the thread tedd started a week or so ago
> > about the best approach for collecting user data.
> > it would be much easier to validate if there were 3 text input fields
> > to collect
Nathan Nobbe wrote:
> i think this ties into the thread tedd started a week or so ago
> about the best approach for collecting user data.
> it would be much easier to validate if there were 3 text input fields
> to collect the data, rather than 1, free-form field.
I would stick to one date field
i think this ties into the thread tedd started a week or so ago
about the best approach for collecting user data.
it would be much easier to validate if there were 3 text input fields
to collect the data, rather than 1, free-form field.
-nathan
I'm having users enter dates in MM-DD- format. is there a way to
check if what they have entered is invalid (like if they enter 1-15-2008
instead of 01-15-2008) ?
Something like this:
http://www.phpguru.org/date_preg/
';
$result = preg_match('/(\d{2})-(\d{2})-(\d{4})/', $input, $mat
On 15/01/2008, Adam Williams <[EMAIL PROTECTED]> wrote:
>
> I'm having users enter dates in MM-DD- format. is there a way to
> check if what they have entered is invalid (like if they enter 1-15-2008
> instead of 01-15-2008) ?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubs
On Jan 15, 2008 9:30 AM, Per Jessen <[EMAIL PROTECTED]> wrote:
> Adam Williams wrote:
>
> > I'm having users enter dates in MM-DD- format. is there a way to
> > check if what they have entered is invalid (like if they enter
> > 1-15-2008 instead of 01-15-2008) ?
>
> A regular expression perha
Adam Williams wrote:
> I'm having users enter dates in MM-DD- format. is there a way to
> check if what they have entered is invalid (like if they enter
> 1-15-2008 instead of 01-15-2008) ?
A regular expression perhaps?
/Per Jessen, Zürich
--
PHP General Mailing List (http://www.php.net/)
30 matches
Mail list logo