$date =date("m-d-Y");  
    $selected =$_REQUEST['sel_day'];// Selected date

$today = strtotime($date); $expiration_date = strtotime($selected); 
    if ($expiration_date > $today) { 
    echo $valid = "yes"; } else { echo $valid = "no"; }

not working?
please help

use [code=language]code [/code] tags, helps
the echo statements are wrong, setting a variable does not need to be echoed, echoing an answer does not need a variable name

$date =date("m-d-Y"); 
$selected =$_REQUEST['sel_day'];// Selected date
$today = strtotime($date); $expiration_date = strtotime($selected); 
if ($expiration_date > $today) { 
echo $valid = "yes"; } else { echo $valid = "no"; }

perhaps something like

(strtotime($_REQUEST['sel_day']) > date() ? $valid = "yes" : $valid = "no");

if else ternary operator ( condition ? result if true : result if false );
default: date() = today text strings are messy and unneccessary

use [code=language]code [/code] tags, helps
the echo statements are wrong, setting a variable does not need to be echoed, echoing an answer does not need a variable name

$date =date("m-d-Y"); 
$selected =$_REQUEST['sel_day'];// Selected date
$today = strtotime($date); $expiration_date = strtotime($selected); 
if ($expiration_date > $today) { 
echo $valid = "yes"; } else { echo $valid = "no"; }

perhaps something like

(strtotime($_REQUEST['sel_day']) > date() ? $valid = "yes" : $valid = "no");

if else ternary operator ( condition ? result if true : result if false );
default: date() = today text strings are messy and unneccessary

Not working

if ((strtotime($_REQUEST['sel_day']) > date() ? $valid = "yes" : $valid = "no") ) 
	echo $valid;

double post, bummer

THere is no IF() statement in my code
the single line ternary statement replaces entirely, all of,

If(condition) {action}
else {action}

try

(strtotime($_REQUEST['sel_day']) > date() ? $valid = "yes" : $valid = "no");
echo $valid;

You have validated the submission elsewhere in the code?? 'sel_day' does exist.

Member Avatar for diafol
$valid = (strtotime($_REQUEST['sel_day']) > time()) ? "yes" : "no";
echo $valid;

date() need a format parameter, so it probably won't work.

$valid = (strtotime($_REQUEST['sel_day']) > time()) ? "yes" : "no";
echo $valid;

date() need a format parameter, so it probably won't work.

@ardav

Thanks for your help...it works.

Member Avatar for diafol

OK mark as solved and while you're at it give A-Bob a rep. His work.

more pebkac errors, time() instead of date()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.