Need help with a simple date script
Posted: Wed Mar 16, 2011 2:24 pm
Hey guys, this is my first post here. I'm by no means a PHP dev, I know this and that about PHP but not extensively. So heres the deal:
I'm trying to post a certain set of dates to a customer. The formula is whatever day they signup on, plus 19 days, and the end of the dates is 77 days from the 19 days. So if a customer signed up today, march 16th, their dates would be:
March 16th + 19 = April 4th
April 4 + 77 = June 1st
Dates = April 4th to June 1st
So heres the code I have right now that captures those dates:
So when I echo this out everything looks fine. The problem is, alot of our customers aren't going to have these variables on file, because its a new system for us. What happens is when they signup, these dates are added to their unique URL string, which would look something like FirstName=blah&SIGNUP=April+4&TPend=June+1 (where TPend is the end date to their specific dates)
What i need to do is have a script to detect if these variables "SIGNUP" and "TPend" are in the URL string. If they aren't, then I need to echo different dates. so i'm sure it would be some sort of if else statement. For instance
New user browses to our site, with variables SIGNUP and TPend present in the URL. I would simply just do a <?php echo $_GET['SIGNUP']; ?> to post that. But if it doesn't exist in the url, i need to do something else. Its sort of hard to explain so please bear with me. Is there a specific way to detect if a variable is present in a URL, and if it isn't, post a different variable?
Any help appreciated!
thanks!
I'm trying to post a certain set of dates to a customer. The formula is whatever day they signup on, plus 19 days, and the end of the dates is 77 days from the 19 days. So if a customer signed up today, march 16th, their dates would be:
March 16th + 19 = April 4th
April 4 + 77 = June 1st
Dates = April 4th to June 1st
So heres the code I have right now that captures those dates:
Code: Select all
<?php
$startdate = mktime (0,0,0,date("m") ,date("d")+19,date("Y"));
$tpstart = date("l F j", $startdate) ."," . date(" Y");
$enddate = mktime (0,0,0,date("m") ,date("d")+77,date("Y"));
$tpend = date("l F j", $enddate) ."," . date(" Y");
?>What i need to do is have a script to detect if these variables "SIGNUP" and "TPend" are in the URL string. If they aren't, then I need to echo different dates. so i'm sure it would be some sort of if else statement. For instance
New user browses to our site, with variables SIGNUP and TPend present in the URL. I would simply just do a <?php echo $_GET['SIGNUP']; ?> to post that. But if it doesn't exist in the url, i need to do something else. Its sort of hard to explain so please bear with me. Is there a specific way to detect if a variable is present in a URL, and if it isn't, post a different variable?
Any help appreciated!
thanks!