Your code below is incomplete, but also wrong. The way you have it set out,
after a POST the page begins with javascript, then the DOCTYPE!

Basically, you should have this sort of structure...

<?php
//define your php functions, eg
function GetSQLValueString(...){ ... }
//set up some variables, eg
$editFormAction = $_SERVER['PHP_SELF'];
.....
$runScript = ''; //initialise this because it needs to exist whether or not
data has been POSTed
//test for POSTed data and act on it, eg
if (isset($_POST) .....){
  //do all your database stuff here...
  .....
  //then, if you want the page to run a certain javascript function to
indicate success (or failure)
  //set a variable up, such as ...
  $runScript = "checkEmail();\n";
}
//output page...
?>
!DOCTYPE....
<html>
<head>
...
<script type='text/javascript' src='jquery.js'></script>
<script type='text/javascript'>
  $(document).ready(function(){
  function checkEmail(){ .....  }
  //do other stuff
  ....
  //output the contents of the PHP runScript variable so that, for example,
the checkEmail() function will
  //get called if the POST was successful
  <?php echo $runScript; ?>
  });
</script>
</head>
<body>...</body></html>



Andy-114 wrote:
> 
> 
> Hi, I need help with small code that i hardly could not be able to
> solve myself.
> 
> I have created subscribe forms that comes with two text field for
> first name and email address.
> 
> Before I created database to insert data into the database, I have
> tested the form with picture background using <div> the blind up the
> background imae along with form and blind down the second image it
> said "thank you for subscribe", is works great with out testing with
> database.
> 
> And now I want to add insert data into he database and once send data
> to database the picture background and forms blind up and blind down
> with second images where it said thank you for subscribe.
> 
> I'm using dreamweaver 8, and create insert code into the mysql, to
> insert database is works great but then i'm getting error message
> after insert database that the form is not blind up and down yet.
> 
> what I wrote was that after insert database it will call javascript
> function "checkemail()" to blind up the background. for some how is
> getting error message.
> 
> the error said:
> 
> line 1
> error 1.
> 
> any idea!
> 
> 
> 
> <?php require_once('../Connections/RegData.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'];
>   }
>   ?><script type="text/javascript">checkEmail();</script><?php
> }
> ?>
> <!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>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/problme-with-jquery...-tf4166917s15494.html#a11856939
Sent from the JQuery mailing list archive at Nabble.com.

Reply via email to