Jump to content

[SOLVED] Trouble with passing url variable and date();


Recommended Posts

I don't know why it is messing up the way it is, but I am entering in my url: month=November, then I am setting

$month = $_GET['month'];

Then echo out $month and it displays November.

Then I try to do:

$date = date('$month 1 Y');

and echo out $date and it gives me: $09o93002

 

Any answers to why this is doing this and how I can insert the month in to that date variable would be great. Thanks

Okay now I am getting:

 

-0500c30obeThu, 11 Sep 2008 14:25:53 -0500 1 2008 

 

with this:

 

if (isset($_GET['month'])){

$month = $_GET['month'];
$date = date("$month 1 Y");
$weekday = date('w', strtotime($date));
echo $date;

} else {

Yeah pretty much the only thing that will change is the month and year, even though I'm not showing year in the example. When I get the month working I will do the year the same way. So when I echo this as

$date = date('F 1 Y');
$weekday = date('w', strtotime($date));
echo $date;

it is September 1 2008, so yeah same thing with whatever Month I decide to put through to it.

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.