hi...i am doing form for bill redemption, and juz wanna ask is there any function in php used to check for expired date? like current month is march, if user enter due month to be january, then it will be invalid. Any function to detect current date?

By the way, i need to pass several variables across pages..i tried session_start() before but seems some hosting or server din support it. I need it because i got two tables in database, which have username in common, so tht i can use the variable to decide which username and insert the data inside the database accordingly.

Thanks for the guidance...if any.

There's no built-in functions exactly for what you want to do so what you need to do is build some code of your own.

First take a look at the date/time functions of PHP. If I'm going to check the month against a textual month I would use something like this

$st = time(); // gets the current time in unix timestamp
$current_month_full = date("F"); // gets full length month like January, December
$current_month_short = date("M"); // gets abbreviated month like Jan, Dec
$current_month_num_zero = date("m"); // gets current month number with leading 0 like 01, 02
$current_month_num = date("n"); // gets the current month number without leading 0 like 1, 2, 3 

// now you need to check against some entered month for example
if($_GET['monthdata'] == $current_month_full){
     echo "The month matches the current month!";
}else{
     echo "The month does not match the current month!";
}

I hope that gives you some direction.

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.