| | |
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 |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





