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


Groups > comp.lang.php > #1703 > unrolled thread

Re: problem saving date fields

Started byCo <vonclausowitz@gmail.com>
First post2011-05-20 14:00 -0700
Last post2011-05-21 16:34 +0200
Articles 12 — 3 participants

Back to article view | Back to comp.lang.php


Contents

  Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-20 14:00 -0700
    Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-20 18:24 -0400
      Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-20 15:52 -0700
        Re: problem saving date fields Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-20 22:30 -0400
        Re: problem saving date fields Luuk <Luuk@invalid.lan> - 2011-05-21 09:57 +0200
          Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-21 01:34 -0700
            Re: problem saving date fields Luuk <Luuk@invalid.lan> - 2011-05-21 11:29 +0200
              Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-21 05:12 -0700
                Re: problem saving date fields Luuk <Luuk@invalid.lan> - 2011-05-21 15:46 +0200
                  Re: problem saving date fields Luuk <Luuk@invalid.lan> - 2011-05-21 16:02 +0200
                  Re: problem saving date fields Co <vonclausowitz@gmail.com> - 2011-05-21 07:09 -0700
                    Re: problem saving date fields Luuk <Luuk@invalid.lan> - 2011-05-21 16:34 +0200

#1703 — Re: problem saving date fields

FromCo <vonclausowitz@gmail.com>
Date2011-05-20 14:00 -0700
SubjectRe: problem saving date fields
Message-ID<a4c77f08-fffc-48e6-a19c-ee39b43bbc62@glegroupsg2000goo.googlegroups.com>
I get a "1" as result.
Don't know what you mean with this.
Problem is that the date is set to 00-00-0000.
Is that because there is a default set in the field (00-00-0000)?

Marco

[toc] | [next] | [standalone]


#1706

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-05-20 18:24 -0400
Message-ID<ir6pm4$nll$1@dont-email.me>
In reply to#1703
On 5/20/2011 5:00 PM, Co wrote:
> I get a "1" as result.
> Don't know what you mean with this.
> Problem is that the date is set to 00-00-0000.
> Is that because there is a default set in the field (00-00-0000)?
>
> Marco

As a result for what?  There's no thread here.

Please use REPLY to a message, not start a new thread.  And quote the 
appropriate parts of the message, to maintain continuity.

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

[toc] | [prev] | [next] | [standalone]


#1713

FromCo <vonclausowitz@gmail.com>
Date2011-05-20 15:52 -0700
Message-ID<3f4554b4-3081-4ad3-a60d-a5ec086123a7@cu4g2000vbb.googlegroups.com>
In reply to#1706
On 21 mei, 00:24, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 5/20/2011 5:00 PM, Co wrote:
>
> > I get a "1" as result.
> > Don't know what you mean with this.
> > Problem is that the date is set to 00-00-0000.
> > Is that because there is a default set in the field (00-00-0000)?
>
> > Marco
>
> As a result for what?  There's no thread here.
>
> Please use REPLY to a message, not start a new thread.  And quote the
> appropriate parts of the message, to maintain continuity.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================

Luuks thought:
print $sql;

it returns 1, dont know what I should do with it.
Problem is that if I only change one of the dates:
arrival_date='$arrival_date',departure_date='$departure_date'

the other one gets to be the default value 00-00-0000.

Marco

[toc] | [prev] | [next] | [standalone]


#1718

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-05-20 22:30 -0400
Message-ID<ir7846$2lp$1@dont-email.me>
In reply to#1713
On 5/20/2011 6:52 PM, Co wrote:
> On 21 mei, 00:24, Jerry Stuckle<jstuck...@attglobal.net>  wrote:
>> On 5/20/2011 5:00 PM, Co wrote:
>>
>>> I get a "1" as result.
>>> Don't know what you mean with this.
>>> Problem is that the date is set to 00-00-0000.
>>> Is that because there is a default set in the field (00-00-0000)?
>>
>>> Marco
>>
>> As a result for what?  There's no thread here.
>>
>> Please use REPLY to a message, not start a new thread.  And quote the
>> appropriate parts of the message, to maintain continuity.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
> Luuks thought:
> print $sql;
>
> it returns 1, dont know what I should do with it.
> Problem is that if I only change one of the dates:
> arrival_date='$arrival_date',departure_date='$departure_date'
>
> the other one gets to be the default value 00-00-0000.
>
> Marco

But what do you get on your window when you display the sql statement 
like he suggested?

Generally, when you're having troubles with SQL statements, it's best to 
print (or echo) the statement to the display to see if you actually have 
what you think you have.

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

[toc] | [prev] | [next] | [standalone]


#1729

FromLuuk <Luuk@invalid.lan>
Date2011-05-21 09:57 +0200
Message-ID<4dd7704a$0$49041$e4fe514c@news.xs4all.nl>
In reply to#1713
On 21-05-2011 00:52, Co wrote:
> On 21 mei, 00:24, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> On 5/20/2011 5:00 PM, Co wrote:
>>
>>> I get a "1" as result.
>>> Don't know what you mean with this.
>>> Problem is that the date is set to 00-00-0000.
>>> Is that because there is a default set in the field (00-00-0000)?
>>
>>> Marco
>>
>> As a result for what?  There's no thread here.
>>
>> Please use REPLY to a message, not start a new thread.  And quote the
>> appropriate parts of the message, to maintain continuity.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
> 
> Luuks thought:
> print $sql;
> 
> it returns 1, dont know what I should do with it.
> Problem is that if I only change one of the dates:
> arrival_date='$arrival_date',departure_date='$departure_date'
> 
> the other one gets to be the default value 00-00-0000.
> 
> Marco

Ok, i responded in the other thread, but wanted to 'add' this:

09:53:29 root@test[14]mysql> insert into testDate values ('21-05-2011');
Query OK, 1 row affected, 1 warning (0.00 sec)

09:55:46 root@test[15]mysql> select * from testDate;
+------------+
| SepDate    |
+------------+
| 0000-00-00 |
| 2011-05-21 |
| 0000-00-00 |
+------------+
3 rows in set (0.00 sec)


-- 
Luuk

[toc] | [prev] | [next] | [standalone]


#1734

FromCo <vonclausowitz@gmail.com>
Date2011-05-21 01:34 -0700
Message-ID<b8b52ba9-c36b-4e30-9716-0dc4f6889861@z37g2000vbl.googlegroups.com>
In reply to#1729
On 21 mei, 09:57, Luuk <L...@invalid.lan> wrote:
> On 21-05-2011 00:52, Co wrote:
>
>
>
>
>
>
>
>
>
> > On 21 mei, 00:24, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> >> On 5/20/2011 5:00 PM, Co wrote:
>
> >>> I get a "1" as result.
> >>> Don't know what you mean with this.
> >>> Problem is that the date is set to 00-00-0000.
> >>> Is that because there is a default set in the field (00-00-0000)?
>
> >>> Marco
>
> >> As a result for what?  There's no thread here.
>
> >> Please use REPLY to a message, not start a new thread.  And quote the
> >> appropriate parts of the message, to maintain continuity.
>
> >> --
> >> ==================
> >> Remove the "x" from my email address
> >> Jerry Stuckle
> >> JDS Computer Training Corp.
> >> jstuck...@attglobal.net
> >> ==================
>
> > Luuks thought:
> > print $sql;
>
> > it returns 1, dont know what I should do with it.
> > Problem is that if I only change one of the dates:
> > arrival_date='$arrival_date',departure_date='$departure_date'
>
> > the other one gets to be the default value 00-00-0000.
>
> > Marco
>
> Ok, i responded in the other thread, but wanted to 'add' this:
>
> 09:53:29 root@test[14]mysql> insert into testDate values ('21-05-2011');
> Query OK, 1 row affected, 1 warning (0.00 sec)
>
> 09:55:46 root@test[15]mysql> select * from testDate;
> +------------+
> | SepDate    |
> +------------+
> | 0000-00-00 |
> | 2011-05-21 |
> | 0000-00-00 |
> +------------+
> 3 rows in set (0.00 sec)
>
> --
> Luuk

Luuk,

forgive me but an I a newbie.
Where do I need to add quotes?
And what does your tests say?

Marco

[toc] | [prev] | [next] | [standalone]


#1735

FromLuuk <Luuk@invalid.lan>
Date2011-05-21 11:29 +0200
Message-ID<4dd78604$0$49181$e4fe514c@news.xs4all.nl>
In reply to#1734
On 21-05-2011 10:34, Co wrote:
> On 21 mei, 09:57, Luuk <L...@invalid.lan> wrote:
>> On 21-05-2011 00:52, Co wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> On 21 mei, 00:24, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>>>> On 5/20/2011 5:00 PM, Co wrote:
>>
>>>>> I get a "1" as result.
>>>>> Don't know what you mean with this.
>>>>> Problem is that the date is set to 00-00-0000.
>>>>> Is that because there is a default set in the field (00-00-0000)?
>>
>>>>> Marco
>>
>>>> As a result for what?  There's no thread here.
>>
>>>> Please use REPLY to a message, not start a new thread.  And quote the
>>>> appropriate parts of the message, to maintain continuity.
>>
>>>> --
>>>> ==================
>>>> Remove the "x" from my email address
>>>> Jerry Stuckle
>>>> JDS Computer Training Corp.
>>>> jstuck...@attglobal.net
>>>> ==================
>>
>>> Luuks thought:
>>> print $sql;
>>
>>> it returns 1, dont know what I should do with it.
>>> Problem is that if I only change one of the dates:
>>> arrival_date='$arrival_date',departure_date='$departure_date'
>>
>>> the other one gets to be the default value 00-00-0000.
>>
>>> Marco
>>
>> Ok, i responded in the other thread, but wanted to 'add' this:
>>
>> 09:53:29 root@test[14]mysql> insert into testDate values ('21-05-2011');
>> Query OK, 1 row affected, 1 warning (0.00 sec)
>>
>> 09:55:46 root@test[15]mysql> select * from testDate;
>> +------------+
>> | SepDate    |
>> +------------+
>> | 0000-00-00 |
>> | 2011-05-21 |
>> | 0000-00-00 |
>> +------------+
>> 3 rows in set (0.00 sec)
>>
>> --
>> Luuk
> 
> Luuk,
> 
> forgive me but an I a newbie.
> Where do I need to add quotes?
> And what does your tests say?
> 
> Marco

Sorry, two seconds after my post i did see you gave  quotes around the
dates.

Only help i can give if you copy paste the output of print $sql here.
If that gives "0000-00-00" (or another wrong date) than something is
wrong in a piece of code you did not show here.....


-- 
Luuk

[toc] | [prev] | [next] | [standalone]


#1740

FromCo <vonclausowitz@gmail.com>
Date2011-05-21 05:12 -0700
Message-ID<14e70364-587f-45ac-a7d8-8cbad3ccefe2@t16g2000vbi.googlegroups.com>
In reply to#1735
On 21 mei, 11:29, Luuk <L...@invalid.lan> wrote:
> On 21-05-2011 10:34, Co wrote:
>
>
>
>
>
>
>
>
>
> > On 21 mei, 09:57, Luuk <L...@invalid.lan> wrote:
> >> On 21-05-2011 00:52, Co wrote:
>
> >>> On 21 mei, 00:24, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> >>>> On 5/20/2011 5:00 PM, Co wrote:
>
> >>>>> I get a "1" as result.
> >>>>> Don't know what you mean with this.
> >>>>> Problem is that the date is set to 00-00-0000.
> >>>>> Is that because there is a default set in the field (00-00-0000)?
>
> >>>>> Marco
>
> >>>> As a result for what?  There's no thread here.
>
> >>>> Please use REPLY to a message, not start a new thread.  And quote the
> >>>> appropriate parts of the message, to maintain continuity.
>
> >>>> --
> >>>> ==================
> >>>> Remove the "x" from my email address
> >>>> Jerry Stuckle
> >>>> JDS Computer Training Corp.
> >>>> jstuck...@attglobal.net
> >>>> ==================
>
> >>> Luuks thought:
> >>> print $sql;
>
> >>> it returns 1, dont know what I should do with it.
> >>> Problem is that if I only change one of the dates:
> >>> arrival_date='$arrival_date',departure_date='$departure_date'
>
> >>> the other one gets to be the default value 00-00-0000.
>
> >>> Marco
>
> >> Ok, i responded in the other thread, but wanted to 'add' this:
>
> >> 09:53:29 root@test[14]mysql> insert into testDate values ('21-05-2011');
> >> Query OK, 1 row affected, 1 warning (0.00 sec)
>
> >> 09:55:46 root@test[15]mysql> select * from testDate;
> >> +------------+
> >> | SepDate    |
> >> +------------+
> >> | 0000-00-00 |
> >> | 2011-05-21 |
> >> | 0000-00-00 |
> >> +------------+
> >> 3 rows in set (0.00 sec)
>
> >> --
> >> Luuk
>
> > Luuk,
>
> > forgive me but an I a newbie.
> > Where do I need to add quotes?
> > And what does your tests say?
>
> > Marco
>
> Sorry, two seconds after my post i did see you gave  quotes around the
> dates.
>
> Only help i can give if you copy paste the output of print $sql here.
> If that gives "0000-00-00" (or another wrong date) than something is
> wrong in a piece of code you did not show here.....
>
> --
> Luuk

Luuk,

Here is all the relevant code:

$birthday_day = "";
$birthday_month = "";
$birthday_year = "";
$arrival_day = "";
$arrival_month = "";
$arrival_year = "";
$departure_day = "";
$departure_month = "";
$departure_year = "";

if ($_POST['parse_var'] == "location"){

	$firstname = preg_replace('#[^A-Za-z]#i', '',
$_POST['firstname']); // filter everything but desired characters
	$lastname = preg_replace('#[^A-Za-z]#i', '', $_POST['lastname']); //
filter everything but desired characters
	$gender = $_POST['gender'];
	$country = strip_tags($_POST['country']);
	$country = str_replace("'", "&#39;", $country);
	$country = str_replace("`", "&#39;", $country);
	$country = mysql_real_escape_string($country);
	$partner = $_POST['partner'];
	$rank = $_POST['rank'];
    $service = $_POST['service'];
	$position = $_POST['position'];

    $arrival_month = preg_replace('#[^0-9]#i', '',
$_POST['arrival_month']);
    print $arrival_month;
	$arrival_day = preg_replace('#[^0-9]#i', '',
$_POST['arrival_day']); // filter everything but numbers
	$arrival_year = preg_replace('#[^0-9]#i', '',
$_POST['arrival_year']); // filter everything but numbers
    $arrival_date = "$arrival_year-$arrival_month-$arrival_day";

    $departure_month = preg_replace('#[^0-9]#i', '',
$_POST['departure_month']);
    print $departure_month;
	$departure_day = preg_replace('#[^0-9]#i', '',
$_POST['departure_day']); // filter everything but numbers
	$departure_year = preg_replace('#[^0-9]#i', '',
$_POST['departure_year']); //
	$departure_date = "$departure_year-$departure_month-$departure_day";

    $birthday_month = preg_replace('#[^0-9]#i', '',
$_POST['birthday_month']);
	$birthday_day = preg_replace('#[^0-9]#i', '',
$_POST['birthday_day']); // filter everything but numbers
	$birthday_year = preg_replace('#[^0-9]#i', '',
$_POST['birthday_year']); // filter everything but numbers
    $birthday_date = "$birthday_year-$birthday_month-$birthday_day";

	$sqlUpdate = mysql_query("UPDATE myMembers SET
firstname='$firstname', lastname='$lastname', gender='$gender',
partner='$partner', country='$country', rank='$rank',
service='$service', position='$position', birthday='$birthday_date',
arrival_date='$arrival_date',departure_date='$departure_date' WHERE
id='$id' LIMIT 1");

    if ($sqlUpdate){
        $success_msg = '<img src="images/round_success.png" width="20"
height="20" alt="Success" />Personal information has been updated
successfully.';
    } else {
		$error_msg = '<img src="images/round_error.png" width="20"
height="20" alt="Failure" /> ERROR: Problems arose during the
information exchange, please try again later.</font>';
    }
}

$sql_default = mysql_query("SELECT * FROM myMembers WHERE id='$id'");

while($row = mysql_fetch_array($sql_default)){

	$firstname = $row["firstname"];
	$lastname = $row["lastname"];
	$gender = $row["gender"];
	$country = $row["country"];
	$rank = $row["rank"];
	$partner = $row["partner"];
	$service = $row["service"];
	$position = $row["position"];
    $birthday_date = explode("-",$row["birthday"]);
	$birthday_year = $birthday_date[0];
	$birthday_day = $birthday_date[2];
    $birthday_month = date( 'F', mktime(0, 0, 0, $birthday_date[1]) );
    $arrival_date = explode("-",$row["arrival_date"]);
	$arrival_year = $arrival_date[0];
	$arrival_day = $arrival_date[2];
    $arrival_month = date( 'F', mktime(0, 0, 0, $arrival_date[1]) );
    $departure_date = explode("-",$row["departure_date"]);
	$departure_year = $departure_date[0];
	$departure_day = $departure_date[2];
    $departure_month = date( 'F', mktime(0, 0, 0,
$departure_date[1]) );
	$email = $row["email"];
	$email_work = $row["email_work"];
	$mobile_phone = $row["mobile_phone"];
	$office_phone = $row["office_phone"];
	$office_fax = $row["office_fax"];
	$home_address = $row["home_address"];
	$residence = $row["residence"];
	$host = $row["host"];
	$bio_body = $row["bio_body"];
	$bio_body = str_replace("<br />", "", $bio_body);
	$bio_body = stripslashes($bio_body);
	$website = $row["website"];
	$youtube = $row["youtube"];
    $facebook = $row["facebook"];
	$twitter = $row["twitter"];
	///////  Mechanism to Display Pic. See if they have uploaded a pic or
not  //////////////////////////
	$check_pic = "members/$id/image01.jpg";
			if ($gender != "f") {
				$default_pic = "members/0/image01.jpg";
			} else {
				$default_pic = "members/0/image02.jpg";
			}

	if (file_exists($check_pic)) {
    $user_pic = "<img src=\"$check_pic?$cacheBuster\" width=\"50px\" /
>"; // forces picture to be 100px wide and no more
	} else {
	$user_pic = "<img src=\"$default_pic\" width=\"50px\" />"; // forces
default picture to be 100px wide and no more
	}


} // close while loop

		<table width="100%" border="0" align="center">
              <tr>
                <td width="34%"><strong>Date of Arrival</strong></td>
                <td width="33%"><strong>Date of Departure</strong></
td>
                <td width="33%"><strong>Birthday</strong></td>
              </tr>
            </table>
    <table width="100%" border="0" align="center">
                <tr>
                  <td width="34%">
<select name="arrival_day" class="formFields" id="arrival_day">
<option value="<?php print "$arrival_day"; ?>"><?php print
"$arrival_day"; ?></option>
<option value="01">1</option>
<option value="02">2</option>
<option value="03">3</option>
<option value="04">4</option>
<option value="05">5</option>
<option value="06">6</option>
<option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<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>
<select name="arrival_year" class="formFields" id="arrival_year">
<option value="<?php print "$arrival_year"; ?>"><?php print
"$arrival_year"; ?></option>
<option value="2011">2013</option>
<option value="2011">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
</select> </td>
<td width="33%">
<select name="departure_day" class="formFields" id="departure_day">
<option value="<?php print "$departure_day"; ?>"><?php print
"$departure_day"; ?></option>
<option value="01">1</option>
<option value="02">2</option>
<option value="03">3</option>
<option value="04">4</option>
<option value="05">5</option>
<option value="06">6</option>
<option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<select name="departure_month" class="formFields"
id="departure_month">
<option value="<?php print "$departure_month"; ?>"><?php print
"$departure_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>
<select name="departure_year" class="formFields" id="departure_year">
<option value="<?php print "$departure_year"; ?>"><?php print
"$departure_year"; ?></option>
<option value="2011">2015</option>
<option value="2011">2014</option>
<option value="2011">2013</option>
<option value="2011">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
</select> </td>
                <td width="33%"><select name="birthday_day"
class="formFields" id="birthday_day">
<option value="<?php print "$birthday_day"; ?>"><?php print
"$birthday_day"; ?></option>
<option value="01">1</option>
<option value="02">2</option>
<option value="03">3</option>
<option value="04">4</option>
<option value="05">5</option>
<option value="06">6</option>
<option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<select name="birthday_month" class="formFields" id="birthday_month">
<option value="<?php print "$birthday_month"; ?>"><?php print
"$birthday_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>
<select name="birthday_year" class="formFields" id="birthday_year">
<option value="<?php print "$birthday_year"; ?>"><?php print
"$birthday_year"; ?></option>
<option value="2011">2013</option>
<option value="2011">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
<option value="1991">1991</option>
<option value="1990">1990</option>
<option value="1989">1989</option>
<option value="1988">1988</option>
<option value="1987">1987</option>
<option value="1986">1986</option>
<option value="1985">1985</option>
<option value="1984">1984</option>
<option value="1983">1983</option>
<option value="1982">1982</option>
<option value="1981">1981</option>
<option value="1980">1980</option>
<option value="1979">1979</option>
<option value="1978">1978</option>
<option value="1977">1977</option>
<option value="1976">1976</option>
<option value="1975">1975</option>
<option value="1974">1974</option>
<option value="1973">1973</option>
<option value="1972">1972</option>
<option value="1971">1971</option>
<option value="1970">1970</option>
<option value="1969">1969</option>
<option value="1968">1968</option>
<option value="1967">1967</option>
<option value="1966">1966</option>
<option value="1965">1965</option>
<option value="1964">1964</option>
<option value="1963">1963</option>
<option value="1962">1962</option>
<option value="1961">1961</option>
<option value="1960">1960</option>
<option value="1959">1959</option>
<option value="1958">1958</option>
<option value="1957">1957</option>
<option value="1956">1956</option>
<option value="1955">1955</option>
<option value="1954">1954</option>
<option value="1953">1953</option>
<option value="1952">1952</option>
<option value="1951">1951</option>
<option value="1950">1950</option>
</select> </td>
                </tr>
            </table>
			<table width="100%" border="0" align="center">
              <tr>
                <td width="34%"><strong>Partner</strong></td>
                <td width="33%"><strong>&nbsp;</strong></td>
                <td width="33%"><strong>&nbsp;</strong></td>
                </tr>
            </table>
            <table width="100%" border="0" align="center">
                <tr>
                  <td width="34%">

Sorry for the length
Marco

[toc] | [prev] | [next] | [standalone]


#1744

FromLuuk <Luuk@invalid.lan>
Date2011-05-21 15:46 +0200
Message-ID<4dd7c22b$0$49045$e4fe514c@news.xs4all.nl>
In reply to#1740
On 21-05-2011 14:12, Co wrote:
> <option value="01">1</option>
....
> <option value="31">31</option>


> Sorry for the length
> Marco

;)

replace it with:
<?php
for ($x=0; $x<=31; $x++) {
	printf('<option value="%02d">>%02d</option>', $x, $x);
} ?>

-- 
Luuk

[toc] | [prev] | [next] | [standalone]


#1745

FromLuuk <Luuk@invalid.lan>
Date2011-05-21 16:02 +0200
Message-ID<4dd7c5fa$0$49041$e4fe514c@news.xs4all.nl>
In reply to#1744
On 21-05-2011 15:46, Luuk wrote:
> On 21-05-2011 14:12, Co wrote:
>> <option value="01">1</option>
> ....
>> <option value="31">31</option>
> 
> 
>> Sorry for the length
>> Marco
> 
> ;)
> 
> replace it with:
> <?php
> for ($x=0; $x<=31; $x++) {
> 	printf('<option value="%02d">>%02d</option>', $x, $x);
> } ?>
> 

oops, you need to select some option:

<?php
$day=21;
for ($x=0; $x<=31; $x++) {
        printf('<option value="%02d" ', $x);
        if ($x==$day) { print ' selected="yes"'; }
        printf('>%02d</option>', $x);
} ?>


-- 
Luuk

[toc] | [prev] | [next] | [standalone]


#1746

FromCo <vonclausowitz@gmail.com>
Date2011-05-21 07:09 -0700
Message-ID<13deed91-e345-45bd-89cb-dc9e76401888@hg8g2000vbb.googlegroups.com>
In reply to#1744
On 21 mei, 15:46, Luuk <L...@invalid.lan> wrote:
> On 21-05-2011 14:12, Co wrote:
>
> > <option value="01">1</option>
> ....
> > <option value="31">31</option>
> > Sorry for the length
> > Marco
>
> ;)
>
> replace it with:
> <?php
> for ($x=0; $x<=31; $x++) {
>         printf('<option value="%02d">>%02d</option>', $x, $x);
>
> } ?>
>
> --
> Luuk

Thanks Luuk

one small typo:
for ($x=0; $x<=31; $x++) {
        printf('<option value="%02d">%02d</option>', $x, $x);

would it be possible to have the numbers 1 till 9 have without leading
0?

Marco

[toc] | [prev] | [next] | [standalone]


#1748

FromLuuk <Luuk@invalid.lan>
Date2011-05-21 16:34 +0200
Message-ID<4dd7cd85$0$49179$e4fe514c@news.xs4all.nl>
In reply to#1746
On 21-05-2011 16:09, Co wrote:
> On 21 mei, 15:46, Luuk <L...@invalid.lan> wrote:
>> On 21-05-2011 14:12, Co wrote:
>>
>>> <option value="01">1</option>
>> ....
>>> <option value="31">31</option>
>>> Sorry for the length
>>> Marco
>>
>> ;)
>>
>> replace it with:
>> <?php
>> for ($x=0; $x<=31; $x++) {
>>         printf('<option value="%02d">>%02d</option>', $x, $x);
>>
>> } ?>
>>
>> --
>> Luuk
> 
> Thanks Luuk
> 
> one small typo:
> for ($x=0; $x<=31; $x++) {
>         printf('<option value="%02d">%02d</option>', $x, $x);
> 
> would it be possible to have the numbers 1 till 9 have without leading
> 0?
> 
> Marco

sure, look at http://nl2.php.net/printf

than you will find the answer is to leave out the '0' after the '%'
printf('<option value="%2d">%2d</option>', $x, $x);

or, if you dont want these leading '0' you could also simply use print,
and not printf()....


-- 
Luuk

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web