I am trying to create a simple record insertion form in Dreamweaver MX. I create a simple recordset, then I create a form. Then I select Insert Record from the menu. I've done is on several pages with no problem at all. But I've got one table that Dreamweaver just won't allow me to add records to.
In the Server Behavior box, next to the Record Insertion behavior, is a red exclamation point. When I open it, I get a dialogue box that says "Could not find the selected tag node."
I've been all over the Internet trying to figure out what this means and how to fix it. I've found a few postings similar to the one I'm making now, but nobody ever gets an answer (including on the Macromedia forums). Is this a Dreamweaver bug? Or am I just missing something?
Here's the code:
<?php require_once('../../Connections/CDBlog.php');
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO tblspecs VALUES (NULL, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['projectid'], "int"),
GetSQLValueString($HTTP_POST_VARS['medium'], "text"),
GetSQLValueString($HTTP_POST_VARS['length'], "text"),
GetSQLValueString($HTTP_POST_VARS['color'], "text"),
GetSQLValueString($HTTP_POST_VARS['completion'], "date"),
GetSQLValueString($HTTP_POST_VARS['daterange'], "text"),
GetSQLValueString($HTTP_POST_VARS['venue'], "text"));
mysql_select_db($database_CDBlog, $CDBlog);
$Result1 = mysql_query($insertSQL, $CDBlog) or die(mysql_error());
$insertGoTo = "projects.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_CDBlog, $CDBlog);
$query_rsSpecs = "SELECT * FROM tblspecs";
$rsSpecs = mysql_query($query_rsSpecs, $CDBlog) or die(mysql_error());
$row_rsSpecs = mysql_fetch_assoc($rsSpecs);
$totalRows_rsSpecs = mysql_num_rows($rsSpecs);
?>
<form name="form1" method="post" action="">
<p>Project:
<input name="projectid" type="text" id="projectid">
</p>
<p>Medium:
<input name="medium" type="text" id="medium">
</p>
<p>Length:
<input name="length" type="text" id="length">
</p>
<p>Color:
<input name="color" type="text" id="color">
</p>
<p>Completion Date:
<input name="completion" type="text" id="competion">
</p>
<p>Date Range:
<input name="daterange" type="text" id="daterange">
</p>
<p>Venue:
<input name="venue" type="text" id="venue">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<?php
mysql_free_result($rsSpecs);
?>