| | |
expired date validation and session
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2007
Posts: 60
Reputation:
Solved Threads: 0
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.
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
I hope that gives you some direction.
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
php Syntax (Toggle Plain Text)
$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.
JRSofty Programming | .NET Dreaming | GalahTech
If your question is solved then mark the thread solved. If someone gives you good advice then give them some rep.
If your question is solved then mark the thread solved. If someone gives you good advice then give them some rep.
![]() |
Other Threads in the PHP Forum
- Previous Thread: Apache & pws
- Next Thread: PHP cookies
| Thread Tools | Search this Thread |
# .htaccess 5.2.10 access alexa apache api array beginner broken cakephp checkbox class clean clients cms code convert cron curl database date directory display dissertation dropdown dynamic echo$_get[x]changingitintovariable... email encode error fairness file folder form forms function functions google hack href htaccess html htmlspecialchars image include indentedsubcategory ip javascript joomla legislation limit link local login mail memberships menu methods multiple multipletables mysql mysqlquery network newsletters oop open passwords paypal pdf persist php provider query radio random redirect remote script search secure server sessions simple sockets source space spam sql system table tutorial upload url user variable video voteup web youtube





