Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #1819

Re: problem saving date fields

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: problem saving date fields
Date 2011-05-23 18:01 -0400
Organization A noiseless patient Spider
Message-ID <irelft$8pj$2@dont-email.me> (permalink)
References (13 earlier) <ircgse$96m$1@dont-email.me> <e74cd181-0d6a-4c5b-af54-ae3ae9b6279c@gv8g2000vbb.googlegroups.com> <irdfg5$v84$1@dont-email.me> <14983f67-9bfd-4ac0-bfd9-ef82fb30a952@gv8g2000vbb.googlegroups.com> <05869633-655f-482b-b163-b8b301603800@w36g2000vbi.googlegroups.com>

Show all headers | View raw


On 5/23/2011 5:26 PM, Co wrote:
> On 23 mei, 19:27, Co<vonclausow...@gmail.com>  wrote:
>> On 23 mei, 13:13, Jerry Stuckle<jstuck...@attglobal.net>  wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> On 5/23/2011 12:51 AM, Co wrote:
>>
>>>>> ==================
>>
>>>> Wow you guys really love each other.
>>
>>>> Marco
>>
>>> Yea, unfortunately, you have to put up with some trolls on usenet.
>>
>>> --
>>> ==================
>>> Remove the "x" from my email address
>>> Jerry Stuckle
>>> JDS Computer Training Corp.
>>> jstuck...@attglobal.net
>>> ==================
>>
>> So when one of the three dates is not changed it returns the month
>> written.
>> Than this code:
>> $arrival_month = preg_replace('#[^0-9]#i', '',
>> $_POST['arrival_month']);
>> ruins the date and it gets set back to 00-00-0000.
>> Is there a way to detect changes? because than I could set an if
>> statement before
>> running the UPDATE query and we leave out the dates that were not
>> changed.
>>
>> Marco
>
> Guys,
>
> I solved the problem.
> Maybe not the nicest way but it is working.
> Here is the code:
>
> $num_arrival_month = "";
> $arrival_month = $_POST['arrival_month'];
> if(!is_numeric($arrival_month)) {
>
> for($i=1;$i<=12;$i++){
> 	if(date("F", mktime(0, 0, 0, $i, 1, 0)) == $arrival_month){
> 	$num_arrival_month = $i;
>      break;
> 					 }
>     				}
> } else {
> 	$num_arrival_month = $arrival_month;
> }
>
> 	$arrival_day = preg_replace('#[^0-9]#i', '', $_POST['arrival_day']);
> 	$arrival_year = preg_replace('#[^0-9]#i', '',
> $_POST['arrival_year']);
>      $arrival_date = "$arrival_year-$num_arrival_month-$arrival_day";
>
>
> Any comments?
>
> Marco

No, you will be much better off learning to use the SELECT element 
properly, as I indicated before.  Look for some HTML tutorials.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-20 11:38 -0700
  Re: problem saving date fields Luuk <Luuk@invalid.lan> - 2011-05-20 20:50 +0200
  Re: problem saving date fields Jeff North <jnorthau@yahoo.com.au> - 2011-05-21 08:58 +1000
    Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-20 22:35 -0400
      Re: problem saving date fields Jeff North <jnorthau@yahoo.com.au> - 2011-05-21 13:13 +1000
        Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-20 23:47 -0700
          Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-21 00:18 -0700
            Re: problem saving date fields Luuk <Luuk@invalid.lan> - 2011-05-21 09:54 +0200
            Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-21 10:37 -0400
              Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-21 08:07 -0700
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-21 19:55 -0400
                Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-22 14:20 -0700
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-22 17:28 -0400
        Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-21 10:32 -0400
          Re: problem saving date fields Jeff North <jnorthau@yahoo.com.au> - 2011-05-22 02:08 +1000
            Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-21 20:01 -0400
              Re: problem saving date fields "Twayne" <nobody@devnull.spamcop.net> - 2011-05-21 20:30 -0400
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-21 23:13 -0400
              Re: problem saving date fields Jeff North <jnorthau@yahoo.com.au> - 2011-05-22 14:28 +1000
                Re: problem saving date fields Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-05-22 12:45 +0200
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-22 08:26 -0400
                Re: problem saving date fields "Twayne" <nobody@devnull.spamcop.net> - 2011-05-22 09:20 -0400
                Re: problem saving date fields Jeff North <jnorthau@yahoo.com.au> - 2011-05-23 00:08 +1000
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-22 13:47 -0400
                Re: problem saving date fields Bill B <me@privacy.net> - 2011-05-22 14:17 -0400
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-22 14:26 -0400
                Re: problem saving date fields Bill B <me@privacy.net> - 2011-05-22 16:27 -0400
                Re: problem saving date fields Jeff North <jnorthau@yahoo.com.au> - 2011-05-23 09:01 +1000
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-22 20:21 -0400
                Re: problem saving date fields Bill B <me@privacy.net> - 2011-05-22 21:36 -0400
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-22 21:46 -0400
                Re: problem saving date fields Jeff North <jnorthau@yahoo.com.au> - 2011-05-23 12:20 +1000
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-22 22:30 -0400
                Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-22 21:51 -0700
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-23 07:13 -0400
                Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-23 10:18 -0700
                Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-23 10:27 -0700
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-23 14:16 -0400
                Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-23 12:17 -0700
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-23 18:00 -0400
                Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-23 22:30 -0700
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-24 05:45 -0400
                Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-26 02:10 -0700
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-26 05:43 -0400
                Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-23 14:26 -0700
                Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-23 18:01 -0400
                Re: problem saving date fields Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-05-23 23:59 +0200
                Re: problem saving date fields "Twayne" <nobody@devnull.spamcop.net> - 2011-05-22 09:11 -0400

csiph-web