I am using Dreamweaver CS3 with Developers Toolbox. After setting up the date formats with the developer toolbox, the help instructs you to insert KT_formatDate($row_rsRecordset['name_emp']) into your pages. This works great for displaying data, however I can't find what to do to fix the date format upon submitting a form. I am using the Insert Record server behavior and assume the KT_formatDate needs to be added there, but no matter where I put it it doesn't seem to work. Any ideas? Here the applicable code:
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $SERVER['PHP_SELF'];
if (isset($SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($POST["MM_insert"])) && ($POST["MM_insert"] == "eventform")) {
$insertSQL = sprintf("INSERT INTO event (locationID, name, typeID, date, availability, showtype, time, location, moreinfo) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($POST['locationID'], "int"),
GetSQLValueString($POST['name'], "text"),
GetSQLValueString($POST['typeID'], "int"),
GetSQLValueString($POST['date'], "date"),
GetSQLValueString($POST['availability'], "text"),
GetSQLValueString($POST['showtype'], "text"),
GetSQLValueString($POST['time'], "date"),
GetSQLValueString($POST['location'], "text"),
GetSQLValueString($_POST['moreinfo'], "text"));
...
<p>
<label for="date">Date:<span class="required">(m/d/yy)</span></label>
<span id="sprytextfield2">
<input name="date" type="text" id="date" />
<span class="textfieldRequiredMsg">Please enter the date of the event.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p>