Forum Moderators: coopster

Message Too Old, No Replies

AutoFill HTML Fields

         

mqcarpenter

2:49 pm on Mar 12, 2009 (gmt 0)

10+ Year Member



I want to assign a value to a form field server side. I need to break out the current month, day and year to be included in a form without the user adding input. What is the cleanest way to handle this? Here is a quick and dirty example of the static fields I am using now:

<input type="hidden" name="DATEMONTH" value="03">
<input type="hidden" name="DATEDAY" value="12">
<input type="hidden" name="DATEYEAR" value="2009">

I can use ASP or PHP for this function.

TIA

Jsyvanne

3:11 pm on Mar 12, 2009 (gmt 0)

10+ Year Member



Would this do the trick?:

<input type="hidden" name="DATEMONTH" value="<?php echo date("m"); ?>">
<input type="hidden" name="DATEDAY" value="<?php echo date("d"); ?>">
<input type="hidden" name="DATEYEAR" value="<?php echo date("Y"); ?>">

mqcarpenter

6:39 pm on Mar 12, 2009 (gmt 0)

10+ Year Member



That did exactly what I needed! Thank you!