Hi,
I have a form that users will use to register with my site. It will simply ask for their Name and Email Address, and put that info into a mySQL table. I would also like to include a datetime stamp so that I know when they registered. As it stands now, there are four fields in the table : ID, Name, Email, and DateSubmitted. The value for the ID field is automatically generated by virtue of it being the primary key (and is auto-incremented as well). The Name and Email info is provided by the user. The DateSubmitted info I want to be automatically generated, but I can't figure out how. I tried a hidden value in my table, but that didn't work. Here's the code I'm using :
<?php
if ($submit) {
$db = mysql_connect("xxx", "xxx");
mysql_select_db("xxx",$db);
$sql = "INSERT INTO register (Name,Email,DateSubmitted) VALUES (´$Name´,´$Email´)";
$result = mysql_query($sql);
header ("Location: http://www.outdoor-resources.com/reg_thanks.html");
} else{
?>
<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=5 WIDTH=610>
<TR>
<TD ColSpan=2 RowSpan=1 BGCOLOR="#669966" ALIGN=CENTER VALIGN=MIDDLE>
<FONT FACE=arial COLOR="000000"><B><A HREF="index.html">Outdoor Resources Online</A>: Register</B></FONT>
</TD>
</TR>
<TR>
<TD ColSpan=1 RowSpan=1>
<BR>
<FORM METHOD="post" ACTION="<?php echo $PHP_SELF?>">
<TABLE BORDER=0 CELLSPACING=5 CELLPADDING=2 WIDTH=600>
<TR>
<TD ColSpan=3 RowSpan=1 Align=Left>
Thank you for registering with Outdoor Resources Online. From time to time (like every few months) we´ll send out an email updating the features you can find at this site. You´ll find the email frequency from this site to be <B>very</B> low!<BR><BR>
<B>Note : The following information is for use by Outdoor Resources Online to help make this site better for you. Your e-mail address will <FONT COLOR=RED>NEVER</FONT> be sold or shared with anyone!</B>
</TD>
</TR>
<TR>
<TD ColSpan=3 RowSpan=1 Align=Left>
Name : <INPUT TYPE="text" NAME="Name" SIZE=40>
</TD>
</TR>
<TR>
<TD ColSpan=3 RowSpan=1 Align=Left>
E-mail Address : <INPUT TYPE="text" NAME="Email" SIZE=40>
</TD>
</TR>
<TR>
<TD ColSpan=3 RowSpan=1 Align=Center>
<INPUT TYPE="submit" VALUE="Submit"> <INPUT TYPE="reset" VALUE="Reset">
</TD>
</TR>
</TABLE>
</FORM>
</TD>
</TR>
</TABLE>
<?php
} // end if
?>
</BODY>
I know that I don't have a corresponsing variable for the DateSubmitted field in the table. I figured I didn't need it if I was auto-generating the value each time an entry was placed in the table. I'm probably wrong.
Any help would be appreciated.
Thanks,
Mark