close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Insert Current date and expiry date

Thread began 7/20/2011 3:15 am by superpac250441 | Last modified 7/28/2011 2:05 pm by Jason Byrnes | 1248 views | 7 replies |

superpac250441

Insert Current date and expiry date

Can someone help me. I am trying to set up a registration form for an annual subscription.

There will be two hidden fields:
1) The current date of registration
2) The expiry date, which is exactly 1 year later
Can this be done? As a novice, any assitance would be much appreciated

Sign in to reply to this post

Jason ByrnesWebAssist

use the following code for the current date:

php:
<?php echo(date("Y-m-d h:m:s")); ?>



and this code for one year from now:

php:
<?php echo(date("Y-m-d h:m:s"mktime(date("h"), date("m"), date("s"), date("m"), date("d"), date("Y") + 1))); ?>
Sign in to reply to this post

superpac250441

BRILLIANT - many thanks Jason

Sign in to reply to this post

Ray BorduinWebAssist

A shorter way to do the date a year from now is:

<?php echo(date("Y-m-d h:n:s", strtotime("+1 year"))); ?>

Sign in to reply to this post

superpac250441

Many thanks but I still can't get it to work so perhaps I gave you the wrong information.

I have set the mysql database fields to DATE

The current form code for I want to change for subscribe date and 1 year later unsubscribe date is:

<input id="HiddenFields_userSubscribeDate" name="HiddenFields_userSubscribeDate" type="hidden" value="<?php echo((isset($_GET["invalid"])?ValidatedField("registration","HiddenFields_userSubscribeDate"):"")); ?>">

<input id="HiddenFields_userExpiryDate" name="HiddenFields_userExpiryDate" type="hidden" value="<?php echo((isset($_GET["invalid"])?ValidatedField("registration","HiddenFields_userExpiryDate"):"")); ?>">

I have tried pasting in the code you provided in to the value = "" but it won't add to the database. Can you advise where I am going wrong. A million thanks

Sign in to reply to this post

Jason ByrnesWebAssist

if the code for generating the date is added correctly to the value of the hidden form elements, but it is not storing in the database, then I would double check that the subscribe date and expiry date column are bound to the hidden elements in the insert record behavior.


if you need further assistance I would need a copy of your page in a zip archive to examine the code

Sign in to reply to this post

superpac250441

Hi Jason,
See the attached zip file. In addition to the above on date, I cannot get the 'agree to terms' checkbox to validate

Attached Files
registration.zip
Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...