Re: Month
| From: | Brad Bonkoski | Date: | Mon, 19 Feb 2007 19:15:10 +0000 |
| Subject: | Re: Month | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249042@lists.php.net to get a copy of this message | ||
Brad Bonkoski wrote:
Dan Shirah wrote:echo "<option value=\"".sprintf('%02s', $m)."\">$months</option>";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"> <?PHPtry: echo "<option value=\".sprintf('%02s', $m)."\">$months</option>"; your trying to call a function inside of a string... oops..typo, forgot the additional {"}for ($m=1;$m<=12;$m++) { $months=date('M', mktime(0, 0, 0, $m, 2)); echo "<option value=\"sprintf('%02s', $m)\">$months</option>";
-B-----Original Message----- From: Dan Shirah [mailto:mrsquash2@gmail.com] Sent: Monday, February 19, 2007 1:44 PM To: Jay Blanchard Cc: php-general Subject: Re: [PHP] Month Okay, so sprintf("%02s", $m) means that the value of $m would be}?> </select> On 2/19/07, Brad Fuller <bfuller@cpacampaigns.com> wrote:for the amount of digits returned. If less than two digits a zerocheckedadded to the front, correct?would beYes. % = start of format string 0 = padding specifier 2 = width specifier s = type specifier (string) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php