Re: Month

From: Date: Mon, 19 Feb 2007 19:26:46 +0000
Subject: Re: Month
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-249045@lists.php.net to get a copy of this message
GAH! Sorry. <rubs eyes> On 2/19/07, Brad Bonkoski <bbonkoski@mediaguide.com> 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@cpacampaigns.com> wrote:
-----Original Message----- From: Dan Shirah [mailto:mrsquash2@gmail.com] 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


« previous php.general (#249045) next »