FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » problem saving date fields
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: problem saving date fields [message #174162 is a reply to message #174160] Mon, 23 May 2011 19:17 Go to previous messageGo to previous message
Co is currently offline  Co
Messages: 75
Registered: May 2011
Karma:
Member
On 23 mei, 20:16, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 5/23/2011 1:27 PM, Co 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.
>
>> 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
>
> OK, the question is, where is it getting the month name instead of the
> number?  It has to be coming from your html code.  Look at the page
> source and see where you're putting 'April' in there instead of 4.
>
> As for detecting when the data changed - the only way is to do something
> like save the current data in your $_SESSION and compare when it is
> retrieved.  However, that isn't necessary if you get your problem with
> the month name being retrieved.  It doesn't hurt to update a value in
> the database with the same value.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

It is getting the name of the month when the pulldown menu is filled.

<select name="arrival_month" class="formFields" id="arrival_month">
<option value="<?php print "$arrival_month"; ?>"><?php print
"$arrival_month"; ?></option>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>

The problem is that during the Post it returns the name instead of the
number.

I tried this code but when I don't change the month it doesn't pass
the code:
if(!is_numeric($arrival_month)) {

for($i=1;$i<=12;$i++){
if(strtolower(date("M", mktime(0, 0, 0, $i, 1, 0))) ==
strtolower($arrival_month)){
$arrival_month = $i;
}
}
print $arrival_month;
}

Marco
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: is dis da place?
Next Topic: foreach in reverse
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 12:23:48 GMT 2024

Total time taken to generate the page: 0.05731 seconds