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'

 

 

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.