Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having problem with August & September!!!! 1

Status
Not open for further replies.

smashing

Programmer
Oct 15, 2002
170
US
I have a form at ( (feel free to fill it out) where users choose a month, passed on via POST in a variable called outmonth with the values of 01, 02, 03 etc. Everything works fine except for 2 values: 08 and 09 which should be converted to August & September. I'm baffled by this, I've gone thru the form & the script a dozen of times checked to see that the values are sent as they should, but I can't find the problem. Please respond a.s.a.p !!!!!


if ($_POST[outmonth] == 00) {
echo &quot;<br><br><h3>You haven't chosen your travel month, please click the back button, enter a date and click submit again</h3>&quot;;
exit; }
//display month name to user instead of just a number
elseif ($_POST[outmonth] == 01) {
$displaydate = &quot;January&quot;;
}
else if ($_POST[outmonth] == 02) {
$displaydate = &quot;February&quot;;
}
else if ($_POST[outmonth] == 03) {
$displaydate = &quot;March&quot;;
}
else if ($_POST[outmonth] == 04) {
$displaydate = &quot;April&quot;;
}
else if ($_POST[outmonth] == 05) {
$displaydate = &quot;May&quot;;
}
else if ($_POST[outmonth] == 06) {
$displaydate = &quot;June&quot;;
}
else if ($_POST[outmonth] == 07) {
$displaydate = &quot;July&quot;;
}
else if ($_POST[outmonth] == 08) {
$displaydate = &quot;August&quot;;
}
else if ($_POST[outmonth] == 09) {
$displaydate = &quot;September&quot;;
}
else if ($_POST[outmonth] == 10) {
$displaydate = &quot;October&quot;;
}
else if ($_POST[outmonth] == 11) {
$displaydate = &quot;November&quot;;
}
else if ($_POST[outmonth] == 12) {
$displaydate = &quot;December&quot;;
}


An idle mind is the Devil's workshop!
 
Remove the leading zeros. Those makes PHP believe that it's an octal number. //Daniel
 
Thanks danielhozac !
Fixed it and works smoothly.
(By the way I remember you from the CGI & Perl forums, where you were just as helpful all the time)
Daniel ! KEEP UP THE GOOD WORK!!!



An idle mind is the Devil's workshop!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top