imarockstar Posted May 26, 2009 Share Posted May 26, 2009 Ok I am trying to get the DATE from this variable that has the month day and year all together like this : $deadline = '05.26.09'; I am exploding the month, day and year into separate variables. When I echo the new variables they display fine .. but when I try and out put them again .. this does not work ... can you see any errors in my below code ? <?php $deadline = '05.26.09'; list($day, $month, $year) = explode(".", $deadline); echo $day; echo $month; echo $year; if ( $month == '05' ) { echo "The if statement evaluated to true"; } // will not output this statement .. ?> <select id="date-sel-mm" name="month" class="FMselect"> <option <?PHP if ($month=="") echo "selected"; ?> value="0">---</option> <option <?PHP if ($month=="-1") echo "selected"; ?> value="-1">Month</option> <option <?PHP if ($month=="01") echo "selected"; ?> value="01">January</option> <option <?PHP if ($month=="02") echo "selected"; ?> value="02">February</option> <option <?PHP if ($month=="03") echo "selected"; ?> value="03">March</option> <option <?PHP if ($month=="04") echo "selected"; ?> value="04">April</option> <option <?PHP if ($month=="05") echo "selected"; ?> value="05">May</option> <option <?PHP if ($month=="06") echo "selected"; ?> value="06">June</option> <option <?PHP if ($month=="07") echo "selected"; ?> value="07">July</option> <option <?PHP if ($month=="08") echo "selected"; ?> value="08">August</option> <option <?PHP if ($month=="09") echo "selected"; ?> value="09">September</option> <option <?PHP if ($month=="10") echo "selected"; ?> value="10">October</option> <option <?PHP if ($month=="11") echo "selected"; ?> value="11">November</option> <option <?PHP if ($month=="12") echo "selected"; ?> value="12">December</option> </select> problems : a) it is not outputting my first 'if' statement : The if statement evaluated to true ( the month DOES == '05' ) b) is not selecting the 'select option' 05 ... and outputing SELECTED ... c) at the beginning of the script when I echo the $month .. it does print '05' Link to comment https://forums.phpfreaks.com/topic/159735-solved-help-with-explode-quick-before-i-throw-my-mac-out-the-window/ Share on other sites More sharing options...
Ken2k7 Posted May 26, 2009 Share Posted May 26, 2009 You messed up the list. Put $month before $day in your list item. Stupid mistake, don't worry about it. Link to comment https://forums.phpfreaks.com/topic/159735-solved-help-with-explode-quick-before-i-throw-my-mac-out-the-window/#findComment-842527 Share on other sites More sharing options...
dennismonsewicz Posted May 26, 2009 Share Posted May 26, 2009 I would throw a mac out of the window just cause it was a mac! LINUX!!!!! Link to comment https://forums.phpfreaks.com/topic/159735-solved-help-with-explode-quick-before-i-throw-my-mac-out-the-window/#findComment-842534 Share on other sites More sharing options...
Ken2k7 Posted May 26, 2009 Share Posted May 26, 2009 I would throw a mac out of the window just cause it was a mac! LINUX!!!!! At least it's not a Windows. Link to comment https://forums.phpfreaks.com/topic/159735-solved-help-with-explode-quick-before-i-throw-my-mac-out-the-window/#findComment-842535 Share on other sites More sharing options...
dennismonsewicz Posted May 26, 2009 Share Posted May 26, 2009 I would throw a mac out of the window just cause it was a mac! LINUX!!!!! At least it's not a Windows. Very true!!! Link to comment https://forums.phpfreaks.com/topic/159735-solved-help-with-explode-quick-before-i-throw-my-mac-out-the-window/#findComment-842541 Share on other sites More sharing options...
imarockstar Posted May 26, 2009 Author Share Posted May 26, 2009 mac vs the world ... that could be a forum on itself .. haha Link to comment https://forums.phpfreaks.com/topic/159735-solved-help-with-explode-quick-before-i-throw-my-mac-out-the-window/#findComment-842543 Share on other sites More sharing options...
imarockstar Posted May 26, 2009 Author Share Posted May 26, 2009 anything is better then a windows box .. i was thinking of getting a netbook and putting linux on there ..but I have never played with that os .. Link to comment https://forums.phpfreaks.com/topic/159735-solved-help-with-explode-quick-before-i-throw-my-mac-out-the-window/#findComment-842544 Share on other sites More sharing options...
imarockstar Posted May 26, 2009 Author Share Posted May 26, 2009 and I cant believe the fix was that easy lol .. i knew i had the code right ... geesh ... i am a moron for that hah thanks for the help Link to comment https://forums.phpfreaks.com/topic/159735-solved-help-with-explode-quick-before-i-throw-my-mac-out-the-window/#findComment-842545 Share on other sites More sharing options...
dennismonsewicz Posted May 26, 2009 Share Posted May 26, 2009 and I cant believe the fix was that easy lol .. i knew i had the code right ... geesh ... i am a moron for that hah thanks for the help HA we all have those days man! Link to comment https://forums.phpfreaks.com/topic/159735-solved-help-with-explode-quick-before-i-throw-my-mac-out-the-window/#findComment-842547 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.