Forums
This topic is locked
Issue with submitting a form
Posted 15 Aug 2006 22:46:35
1
has voted
15 Aug 2006 22:46:35 Colby Lyons posted:
Hi All, Sorry for the nickel question, but I'm going crazy. I am new at PHP coding and I believe I am missing something so simple to get my form to upload to my table correctly. MySQL and Dreamweaver 8.0.2 are corresponding okay and the connection has been made, but I am getting an error which reads:
Fatal error: Call to undefined function: virtual() in /homepages/20/d153033853/htdocs/register.php on line 1
Below is the code that is above the header in DW... if you don't mind helping me with the obvious, I would be most obliged.
Thanks very much in advance...
Colby
<?php insert('/Connections/registrations.php'); ?>
<?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"] == "form1") {
$insertSQL = sprintf("INSERT INTO RegistrationPage (FirstName, LastName, Organization, Address, Suite, City, `State`, Zip, Phone, Email, Previous, Suggestions, Updates, `Date`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['FirstName'], "text",
GetSQLValueString($_POST['LastName'], "text",
GetSQLValueString($_POST['Organization'], "text",
GetSQLValueString($_POST['Address'], "text",
GetSQLValueString($_POST['Suite'], "text",
GetSQLValueString($_POST['City'], "text",
GetSQLValueString($_POST['State'], "text",
GetSQLValueString($_POST['Zip'], "text",
GetSQLValueString($_POST['Phone'], "text",
GetSQLValueString($_POST['Email'], "text",
GetSQLValueString($_POST['Previous'], "text",
GetSQLValueString($_POST['Suggestions'], "text",
GetSQLValueString($_POST['Updates'], "text",
GetSQLValueString($_POST['Date'], "date");
mysql_select_db($database_registrations, $registrations);
$Result1 = mysql_query($insertSQL, $registrations) or die(mysql_error());
}
?>
Replies
Replied 16 Aug 2006 10:59:48
16 Aug 2006 10:59:48 Roddy Dairion replied:
on the first line instead of using insert() use include ()