this is my html code:
[HTML]<form name="frminfo" action="<?php $_SERVER['PHP_SELF']?>" method="post">
<table width="85%" border="0" align="center">
<tr>
<td valign="top" class="desc">
State <font class="red">*</font>
</td>
<td valign="top" colspan="3">
<select name="selstate" onchange="showCity(this.value);" class="txtsty">
<option value="">Select State</option>
<option value="1">Maharashtra</option>
<option value="2">Delhi</option>
<option value="3">Gujarat</option>
<option value="4">Punjab</option>
</select>
</td>
</tr>
<tr>
<td valign="top" class="desc">
City <font class="red">*</font>
</td>
<td valign="top">
<div id="divcity"></div>
</td>
<td valign="top" colspan="2">
<input type="button" name="btncity" value="Add City" onclick="javascript
:openPop(550,150)" class="btn">
</td>
</tr>
<tr>
<td valign="top" class="desc">
School <font class="red">*</font>
</td>
<td valign="top">
<div id="divschool"></div>
</td>
<td valign="top" colspan="2">
<input type="button" class="btn" name="btnschool" value="Add Institute" onclick="return valschool();">
</td>
</tr>
<tr>
<td valign="top" class="desc">
Contact Person Met<font class="red">*</font>
</td>
<td valign="top">
<input type="text" name="txt1">
</td>
</tr>
<tr>
<td valign="top" align="left" class="desc">
Remarks <font class="red"></font>
</td>
<td valign="top">
<textarea name="remarks" maxlength="350" rows="5" cols="25" class="txtsty"></textarea>
</td>
</tr>
<tr>
<td valign="top" class="desc">
Call Analysis <font class="red">*</font>
</td>
<td valign="top" colspan="2">
<select name="scall" class="txtsty">
<option value="">Select Call Analysis</option>
<option value="1">First Call(Tele)</option>
<option value="2">Follow up call(Tele)</option>
<option value="3">First call (Field)</option>
<option value="1">Follow up call(Field)</option>
</select>
</td>
</tr>
<tr>
<td valign="top" class="desc">
School Status <font class="red">*</font>
</td>
<td valign="top">
<select name="sel1">
<option value="">Select</option>
<option value="1">Interested</option>
<option value="2">Uninterested</option>
<option value="3">Undecided</option>
</select>
</td>
</tr>
<tr>
<td valign="top" align="right" class="desc">
Next Contact Date<font class="red"></font>
</td>
<td valign="top" colspan="3">
<INPUT TYPE="text" NAME="sdate" VALUE="<?php echo $sdate;?>" SIZE="10" maxlength="10" readonly class="txtsty">
<A HREF="#" onClick="cal.select(document.forms['frminfo'].sdate,'anchor1','dd/MM/yyyy'); return false;"
NAME="anchor1" ID="anchor1">select</A>
</td>
</tr>
<tr>
<td valign="top" colspan="4" align="center">
<input type="button" name="btn1" class="btn" onclick="addDetails(this.form);" value=" Save Details ">
</td>
<td>
<div id="divtest"></div>
</td>
</tr>
</table>
</form>[/HTML]
button : btn1 is the button on the click of which i call function addDetails(this.form);
and the ajax function addDetails is
- function addDetails(form1)
-
{
-
xmlHttp=GetXmlHttpObject();
-
if (xmlHttp==null)
-
{
-
alert ("Your browser does not support AJAX!");
-
return;
-
}
-
-
alert(form1);
-
var url="ajax_add.php";
-
xmlHttp.onreadystatechange=stateChanged4;
-
xmlHttp.open("POST",url,true);
-
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
-
//xmlHttp.setRequestHeader("Content-length",form1.length);
-
//xmlHttp.setRequestHeader("Connection", "close");
-
xmlHttp.send(form1);
-
}
-
function stateChanged4()
-
{
-
if (xmlHttp.readyState==4)
-
{
-
document.getElementById("divtest").innerHTML=xmlHttp.responseText;
-
}
-
}
this is my php code where i need to fetch the values from html form:
[PHP] $txtdate=$_POST["txtdate"];
$date=$txtdate;
$sid=$_POST["selstate"];
$cid=$_POST["selcity"];
$school=$_POST["school"];
$svid=$_POST["svisit"];
$cperson=$_POST["cperson"];
$scid=$_POST["scall"];
$remarks=$_POST["remarks"];
$min_to = $_POST["minto"];
$time_to = $_POST["timeto"];
$min_from = $_POST["minfrom"];
$time_from = $_POST["timefrom"];
$sdate=$_POST["sdate"];
$status=$_POST['status'];
$fromdate1=array();
$fromdate1 = explode("/",$date);
$dat=$fromdate1[0];
$mon=$fromdate1[1];
$year=$fromdate1[2];
$date= $year."-".$mon."-".$dat;
$currentdatetime=date("Y-m-d H:i:s");
$insertquery="insert into daily_transaction(zid,uid,date_user,date_schedule, sid,cid,ssid,institute_id,status_id,contact_person ,call_id,remarks,time_from,min_from ,time_to,min_to,date)values('$zid','$userid','$dat e','$sdate','$sid','$cid','$status','$school','$sv id','$cperson', '$scid','".addslashes($remarks)."','$time_from','$ min_from','$time_to','$min_to','$currentdatetime') ";
$result = mysql_query($insertquery);[/PHP]
javascript error im getting is "INCORRECT PARAMETER PASSED"
thanx.