Question : ajax form error

hi
i am trying to use jquery form. however, what is happening instead of the success appearing in the div it is appearing in the php page that the form is passing too. i have attached the code and would be grateful if someone could tell me what is wrong? many thanks
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
this call the form from onpress

<script type="text/javascript">
function fileadd(){ 

          jQuery.facybox({ div: '#addform' });
}

form script
----------------------------------------------------------

<script type="text/javascript">

// prepare the form when the DOM is ready 
 
    // bind form using ajaxForm 
    $('#addform').ajaxForm({ 
        // target identifies the element(s) to update with the server response 
        target: '#htmlExampleTarget', 
 
        // success identifies the function to invoke when the server response 
        // has been received; here we apply a fade-in effect to the new content 
        success: function() { 
            $('#htmlExampleTarget').fadeIn('slow'); 
        } 
		
    }); 


</script>

form
------------------------------------------------------

<div id="addform" style="display:none;">
  <form action="filesadd.php" method="post" class="webform">
    <fieldset>
    <legend><span>Enter a File</span></legend>
    <label for="box">Select a Box</label>
    <select name="box">
      <option SELECTED VALUE="">Select a Box</option>
      <?php
do {  
?>
      <option value="<?php echo $row_Recordset1['boxref']?>"><?php echo $row_Recordset1['boxref']?></option>
      <?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  $rows = mysql_num_rows($Recordset1);
  if($rows > 0) {
      mysql_data_seek($Recordset1, 0);
	  $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  }
?>
      
    </select>
    <label for="fileno">File Number:</label>
    <input id="fileno" name="fileno" class="text" type="text" />
	<div id="htmlExampleTarget"></div>
    <label for="authorised">Authorised By:</label>
    <input name="authorised" type="text" class="text" id="authorised" value="<?php echo $_SESSION['kt_name_usr']; ?>" />
    </fieldset>
    <input class="submit" type="submit"  name="submit" value="Add File" />
  </form>
</div>

fileadd.php
-------------------------------------------------------

$sql = "SELECT custref FROM files WHERE custref = '$fileno' ";
$result = runSQL($sql) or die(mysql_error());
if (mysql_num_rows($result)>0){
   echo '<div style="background-color:#ffa; padding:20px">' . $fileno . 'Is already in the database' . '</div>';

}else{
   //insert into db;
   echo '<div style="background-color:#ffa; padding:20px">' . $fileno . "Box: " . $box . $authorised . 'Successfull' . '</div>';
   $sql = "INSERT INTO `files` (customer, authorisation, boxstatus, boxref, custref, filestatus) VALUES ('$customer', '$authorised', '$boxstatus', '$box', '$fileno', $filestatus)";
   $result = runSQL($sql) or die(mysql_error());
   //echo 'This record is valid';
   //header("Location: http://localhost/sample/admin/files/index.php");
		//exit();
}

Answer : ajax form error

thanks. i have narrowed it down to the facybox plugin. if i open the form in facybox then the form plugin does not work  does anyone know if facybox strips tags from form or html? thanks
Random Solutions  
 
programming4us programming4us