Jump to content

[SOLVED] help with EXPLODE .... quick before i throw my mac out the window !!!!


imarockstar

Recommended Posts

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'

 

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.