Hi, I'm trying to create subcriber forms to insert data into the database using Ajax and javascripts and php.
when I run and tested it, to insert informaiton into database is works great, but after insert it i want to call javascripts function called "desubmit()" [B](see code in bold and underline), [/B]but is not calling after succesfull inserted data into the databse.
The error i'm getting from browser after inserted data into the database:
line:1
char:1
error: object expect
code: 0
My question is that what went wrong with line 1! i can't seem to find any error on line one! Is the line one is start from <php> or start from <html> ! any idea what wrong with line 1!
please help, thanks.
please see code:
<?php require_once('../Connections/RegData.php'); ?>
<?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 = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "myform")) {
$insertSQL = sprintf("INSERT INTO pol_emaillist (Name, Email) VALUES (%s, %s)",
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['email'], "text"));
mysql_select_db($database_RegData, $RegData);
$Result1 = mysql_query($insertSQL, $RegData) or die(mysql_error());
// $insertGoTo = "../WORKS.PHP";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
[U][B]?><script type="text/javascript">desubmit();</script><?php [/B][/U]
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0041)http://interface.eyecon.ro/demos/ifx.html -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Interface FX demo - Interface plugin for jQuery</TITLE>
<META http-equiv=Content-Language content=en>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<SCRIPT src="Jquary2_files/jquery.js" type=text/javascript></SCRIPT>
<SCRIPT src="Jquary2_files/interface.js" type=text/javascript></SCRIPT>