Re: [PHP] Month



GAH! Sorry. <rubs eyes>

On 2/19/07, Brad Bonkoski <bbonkoski@xxxxxxxxxxxxxx> wrote:

Dan Shirah wrote:
> Just when I think I'm getting the hang of PHP, I get confused beyond
> belief
> :|
>
> Is this working for you guys? When I test my page only 1/2 of the
months
> show up now. <scratching head>
>
> <select name="month">
> <?PHP
> for ($m=1;$m<=12;$m++) {
> $months=date('M', mktime(0, 0, 0, $m, 1));
> echo "<option value=\"".sprintf("%02d", $m).\">$months</option>";
Still missing a double quote in there.
echo "<option value=\"".sprintf("%02d", $m)."\">$months</option>";
> }
> ?>
> </select>
>
>
> On 2/19/07, Brad Fuller <bfuller@xxxxxxxxxxxxxxxx> wrote:
>>
>> > -----Original Message-----
>> > From: Dan Shirah [mailto:mrsquash2@xxxxxxxxx]
>> > Sent: Monday, February 19, 2007 2:08 PM
>> > To: Brad Fuller
>> > Cc: Jay Blanchard; php-general
>> > Subject: Re: [PHP] Month
>> >
>> > Okay, when I try the sprintf I get the following error when I try to
>> save
>> > my
>> > form
>> >
>> > Incorrect syntax near 's'.
>> >
>> > <select name="month">
>> > <?PHP
>> > for ($m=1;$m<=12;$m++) {
>> > $months=date('M', mktime(0, 0, 0, $m, 2));
>> > echo "<option value=\"sprintf('%02s', $m)\">$months</option>";
>> > }
>> > ?>
>> > </select>
>>
>> I'm pretty sure you need to use double quotes on the format string.
>>
>> echo "<option value=\"".sprintf("%02s", $m)."\">$months</option>";
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>




Relevant Pages

  • Re: Need help using OBJECT tag
    ... Now please learn to quote on Usenet: ... I originally designed it to use SSI. ... my pages to fit into this PHP application. ... probably have to rename all of my .html files to .php and rewrite them ...
    (comp.infosystems.www.authoring.html)
  • Re: unset($_SESSION[var]) fails
    ... sebastian - please make sure you quote the message to which you ... |In my original environment (PHP 4.3.2) this line will delete the ... the OP asked why his $_SESSION variable was not getting unset when he ... andre at twg dot com dot au ...
    (comp.lang.php)
  • Re: php sql "DROP TABLE" command
    ... $conn = mysql_connect; ... BEGINNING OF PHP ... If I put products in back ticks as `products` in the DROP command, ... Use single quote in the $conn command, ...
    (comp.lang.php)
  • Re: Post with redirect?
    ... and it can't be done with PHP. ... the only thing jerry got right is that it would be a lot of work. ... Because you shouldn't be quoting out of context. ...
    (comp.lang.php)
  • Re: PHP generated content seen by spiders?
    ... randomly select the quote and item from a database and echo it to the ... If you have a selection of testimonials, why not put them all in their ... Why use PHP at all? ... help rankings. ...
    (alt.internet.search-engines)