combine fullcalendar with a modal dialog and ajax processing in background for adding new events

So ive done a bit testing and trying:

select: function(start, end, allDay) {
    $  ('#basic-modal-content').modal();

    $  ("form#myform").submit(function() {
        // we want to store the values from the form input box, then send via ajax below
        var title     = $  ('#title').attr('value');
        var description     = $  ('#description').attr('value');  

        $  .ajax({
            type: "POST",
            url: "set-events.php",
            dataType: 'json',
            async: false,

            data: "title="+ title +"& description="+ description,
            success: function(){
                $  ('form#modal').hide(function(){$  ('div.success').fadeIn();});
                }
            });
        return false;
    });
            },

with that snippet i get a form loaded if i select a day:

<div id="basic-modal-content">
        <form name="myform" id="myform" action="" method="POST">  

            <h3>Dialog</h3>
            <p>Enter your information here</p>
            <!-- The Name form field -->
    <label for="title" id="titel_label">title</label>
    <input type="text" name="title" id="title" size="30" value=""/>
    <br>
        <label for="description" id="description">plot</label>
    <input type="description" name="description" id="description" size="30" value=""/>
    <br>
                <input type="submit" name="submit" value="Submit">
</form>
        </div>

thats my set-event.php for insert the data in my eventtable:

 <?php
  //database settings

  $  hostname = 'localhost';
  $  username = 'me';
  $  password = 'something';
  $  dbname = 'calendar';

  $  db = mysql_connect($  hostname,$  username,$  password) or die ("connection not possible");
  mysql_select_db($  dbname, $  db) or die ("database error");

    // event INFORMATION
    $  title        = htmlspecialchars(trim($  _POST['title']));
    $  description        = htmlspecialchars(trim($  _POST['description']));  

    $  addEvent  = "INSERT INTO events (title,description) VALUES ('$  title','$  description')";
    mysql_query($  addEvent) or die(mysql_error());
?>

Not all i want to insert but for testing enough, but why its not inserting my inputs in the database?

newest questions tagged jquery – Stack Overflow

About Admin