Jump to content

Date from $_GET


ebolt007

Recommended Posts

Ok, I have a form with a field that is a datre currently set to use the follwing date;

$main_date = date("l, F j, Y", $cur_date_timestamp);

and my input area is as follows.

echo "<form action=\"mobile_index.php\" enctype=\"multipart/form-data\" method=\"get\" name=\"update_form\">\n";
echo "<input type='text' size=\"26\" name='date' class=\"mobile_input\" value='$main_date' onKeyPress=\"return submitenter(this,event)\">\n";
echo "</form>\n";

Now when this submits I get mobile_index.php?date=Monday%2C+October+17%2C+2012 in my url

 

I need to get that date tho and use it as a variable so I can break it apart into 3 parts like.

$main_date2 = $_GET['date'];
                $main_date = date("M-d-Y", $main_date2);
              	$cur_day = date("d", $main_date);
              	$cur_month = date("n", $main_date);
              	$cur_year = date("Y", $main_date);

 

Is there anyway to do this? I get Warning: date() expects parameter 2 to be long, string given in /home/admin/public_html/mobile_index.php on line 15 Because the date isn't an integer variable PHP understands, because line 15 is $main_date = date("M-d-Y", $main_date2); How do I break the $main_date2 into yeear, month and day so I can work with it?

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/249282-date-from-_get/
Share on other sites

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.