$org field value don't save into database? JQuery

$org field value don't save into database? JQuery

 Hi guys,

These are my codes below,
[B]index.php[/B]

  1. <!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>
    <title>Submit form using Jquery to MySQL with PHP</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script src="jquery-1.4.2.js" type="text/javascript"></script>
    <script src="jquery.js" type="text/javascript"></script>
    </head>

    <body>
       <div class="container"> 
        <form id="submit" method="post"> 
        <fieldset> 
        <legend>Enter Information</legend> 
          <label for="fname">Client First Name:</label> 
                    <input id="fname" class="text" name="fname" size="20" type="text">  <br>
         
          <label for="lname">Client Last Name:</label> 
                    <input id="lname" class="text" name="lname" size="20" type="text">  <br>

          <label for="org">Organization:</label> 
                    <input id="org" class="text" name="org" size="20" type="text"> 
                   
        <button class="button positive">Add Client </button> 
        </fieldset> 
      </form> 
       <div class="success" style="display: none;">Client has been added.</div> 
      </div> 

    </body>
    </html>
































[B]jquery.js[/B]

  1.     $(document).ready(function(){ 

            $("form#submit").submit(function() { 

            // we want to store the values from the form input box, then send via ajax below 

            var fname     = $('#fname').attr('value'); 
            var lname     = $('#lname').attr('value'); 
            var org            = $('#org').attr('value');                 

                $.ajax({ 
                    type: "POST", 
                    url: "ajax.php", 
                    data: "fname="+ fname +"& lname="+ lname +"& org="+ org, 
                   success: function(){ 
                       $('form#submit').hide(function(){$('div.success').fadeIn();}); 
                   } 
               }); 
           return false; 
           }); 

       }); 
























[B]ajax.php[/B]

  1. <?php 
       
        include ("config.php"); 
        
        // CLIENT INFORMATION 
        $fname        = htmlspecialchars(trim($_POST['fname'])); 
        $lname        = htmlspecialchars(trim($_POST['lname'])); 
            $org            = htmlspecialchars(trim($_POST['org'])); 
        
        $addClient  = "INSERT INTO clients (fname,lname,org) VALUES ('$fname','$lname','$org')"; 
        mysql_query($addClient) or die(mysql_error()); 
        
    ?> 

















The problem is when I submit the form the $org field of the form don't save
into the database?

Where did I made wrong?


Thanks in advanced.