Answered
Coldfusion mx 7 and MYSQL
Hi everyone,
I am trying to insert a date into a database from a date chooser using Javascript. My form page is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<script language="javascript" type="text/javascript" src="datetimepicker.js">
//Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
//Script featured on JavaScript Kit ( http://www.javascriptkit.com)
//For this script, visit http://www.javascriptkit.com
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Form</title>
<style type="text/css">
.content {
border:1px #000000 solid;
}
body {background:white;
}
</style>
</head>
<body>
<div id="content">
<form action="insert.cfm" method="post">
<table align="left" bgcolor="white">
<tr>
<th colspan="2">
<font size="+1">Add an Event</font>
</th>
</tr>
<tr>
<td>
Title:
</td>
<td>
<input type="text" name="title" size="50" maxlength="40" />
</td>
</tr>
<tr>
<td>
Date:
</td>
<td>
<input id="demo1" type="text" size="25" name="demo1"><a href="javascript:NewCal('demo1','ddmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
</td>
</tr>
<tr>
<td>
Description:
</td>
<td>
<textarea name="Description" cols="40" rows="5" wrap="virtual"></textarea>
</td>
</tr>
<td>
<input type="submit" value="Insert" align="right" />
</td>
</tr>
</div>
</body>
</html>
and my insert page is:
<cfquery datasource = "test">
INSERT INTO test(description, event_date, title)
VALUES('#FORM.Description#',
'#FORM.demo1#',
'#FORM.title#'
)
</cfquery>
How can I insert the date into the database? And, How can I also retrieve that same date from the database. Just for understaing, I am working on a Web-Calendar for my company.
Thank you for your quick response to this?
I am trying to insert a date into a database from a date chooser using Javascript. My form page is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<script language="javascript" type="text/javascript" src="datetimepicker.js">
//Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
//Script featured on JavaScript Kit ( http://www.javascriptkit.com)
//For this script, visit http://www.javascriptkit.com
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Form</title>
<style type="text/css">
.content {
border:1px #000000 solid;
}
body {background:white;
}
</style>
</head>
<body>
<div id="content">
<form action="insert.cfm" method="post">
<table align="left" bgcolor="white">
<tr>
<th colspan="2">
<font size="+1">Add an Event</font>
</th>
</tr>
<tr>
<td>
Title:
</td>
<td>
<input type="text" name="title" size="50" maxlength="40" />
</td>
</tr>
<tr>
<td>
Date:
</td>
<td>
<input id="demo1" type="text" size="25" name="demo1"><a href="javascript:NewCal('demo1','ddmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
</td>
</tr>
<tr>
<td>
Description:
</td>
<td>
<textarea name="Description" cols="40" rows="5" wrap="virtual"></textarea>
</td>
</tr>
<td>
<input type="submit" value="Insert" align="right" />
</td>
</tr>
</div>
</body>
</html>
and my insert page is:
<cfquery datasource = "test">
INSERT INTO test(description, event_date, title)
VALUES('#FORM.Description#',
'#FORM.demo1#',
'#FORM.title#'
)
</cfquery>
How can I insert the date into the database? And, How can I also retrieve that same date from the database. Just for understaing, I am working on a Web-Calendar for my company.
Thank you for your quick response to this?