Jump to content


Photo

Adding date to hidden field


  • Please log in to reply
1 reply to this topic

#1 rmt123

rmt123
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 28 April 2006 - 12:29 PM

Hi
i hope someone can help me, i am still very new to coding

[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]strOutput += "<TD CLASS=\"entry\<input type=hidden name=Date value="???????????"></TD>";[!--colorc--][/span][!--/colorc--]

is the above code correct so far and what do i have to replace ????????????????? with so that it will save todays date (and time if possible) into my database

anyone who can help me please greatly appreciated

regards
scottt

#2 GBS

GBS
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 28 April 2006 - 04:04 PM

Hi there,

To get the date using javascript,, you could try something like:
<html>
<body>

<script>
var d=new Date();
</script>

<table>
<tr>
<td><input type=hidden name=Date id=Date></td>
</tr>
</table>

<script>
document.getElementById('Date').setAttribute("value",d);
// debug line:
alert('date is: '+document.getElementById("Date").getAttribute("value"));
</script>
</body>
</html>

Some tips (hmm, maybe in french,,) on this site: [a href=\"http://www.asp-php.net/tutorial/scripting/dates.php\" target=\"_blank\"]date functions & javascript[/a]

But you will need to use php/Mysql to save the dates into your database,...

So, better use php like:
1- get the date with php date function,
2- save it using mysql into a database

Hoping it helps,

l8tr,,
Sorry for my english,... I do my best, but sometimes,...
1st intention: understand the problem
2nd intention: try to solve it
3rd intention: try to understand how to solve it :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users