BoarderLine Posted November 12, 2008 Share Posted November 12, 2008 Hi there, I have a form that when submitted has 2x hidden fields. The first hidden field enters a Join Date into the database and the second an Expiry Date (Date + 6 months) from account setup. I am using DW CS3 and have entered the code {now} into the default value field for the date entry which seems to be working fine however am using {now + 6 months} for the expiry value for the second field, which is not working:-(. I have tried several alternate values here and searched for hours however nothing seems to work??? $userRegistration->addColumn("Join_Date", "DATE_TYPE", "VALUE", "{NOW} "); $userRegistration->addColumn("FreeExpire", "DATE_TYPE", "VALUE", "{NOW + 6 months}"); Secondly, is it possible to have the Expiry Date set as a session cookie also when the form is submitted?? How could I achieve this ? :-/ Appreciate any help on this - Thanks. Link to comment https://forums.phpfreaks.com/topic/132361-datefuturetime-session-cookie-hopefully/ Share on other sites More sharing options...
foxtrotwhiskey Posted November 12, 2008 Share Posted November 12, 2008 Hi BoarderLine, What class are you using to access this function? Not exactly sure what it does... $userRegistration->addColumn You shouldn't store this kind of thing in a hidden form field. People could change them easily and maybe set their join date/expiry date to whatever they want. You should handle this yourself in the script that handles the form submission with something like: $seconds_in_6months = 60*60*24*30*6; $join_date = time(); $expiry_date = $join_date + $seconds_in_6months; Link to comment https://forums.phpfreaks.com/topic/132361-datefuturetime-session-cookie-hopefully/#findComment-688205 Share on other sites More sharing options...
BoarderLine Posted November 12, 2008 Author Share Posted November 12, 2008 Thanks foxtrotwhisky, although it seems silly it is really good to be directed back on track. Thanks for the advice. Link to comment https://forums.phpfreaks.com/topic/132361-datefuturetime-session-cookie-hopefully/#findComment-688253 Share on other sites More sharing options...
kenrbnsn Posted November 12, 2008 Share Posted November 12, 2008 You can use the strtotime function here: <?php $join_date = time(); $expiry_date = strtotime('+6 months'); ?> Ken Link to comment https://forums.phpfreaks.com/topic/132361-datefuturetime-session-cookie-hopefully/#findComment-688254 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.