Forums

Help use external javascript and php scripts

rading 11 Aug, 2009
Hey guys?

I have created a form that has some ajax code in it (within javascript tags). This I did with dreamweaver for debugging purposes. It goes something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Payments</title>
</head>
<body>
<script language="javascript" type="text/javascript">
<!-- 
//Browser Support Code
function ajaxFunction(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
.
.
. more stuff goes here...
.
.

	ajaxRequest.open("GET", "ajax.php" + queryString, true);
	ajaxRequest.send(null); 

}
//-->
</script>

<form name="payment">
    <label class="cf_label" style="width: 150px;">Student Id</label>
    <input class="cf_inputbox required validate-number" onblur="ajaxFunction()" maxlength="150" size="30" title="" id="stid" name="student_id" type="text" /> 
<br /><br />
.
.
.
. more form elements here
.
.
.
.
   <input value="Make Payment" name="pay" type="submit" />
</form>
</body>
</html>


I now want to use this on a similar chronoform that I have created with chronoforms. It also links to a database table.

Ok. As you can see, the file above calls a php file called ajax.php. How to I attach this file to the chronoform I have created?? The html part is ok and for the javascript part I copied it to the form code part called Form JavaScript but without the script tags and I think its also ok.

I have tried copying it (ajax.php) to the root of my joomla installation but submitting the form afterwards brings alot of errors such as below.
Parse error: parse error, expecting `','' or `';'' in C:\xampp\htdocs\Joomla\components\com_chronocontact\chronocontact.php(52) : eval()'d code on line 10

Fatal error: Call to a member function bind() on a non-object in C:\xampp\htdocs\Joomla\components\com_chronocontact\libraries\customcode.php(59) : eval()'d code on line 13


I dont understand how this has come about.

Any ideas??
nml375 11 Aug, 2009
Hi,
Could you please verify that you have no dashes or spaces in your database table names?

/Fredrik
This topic is locked and no more replies can be posted.