webismymind / editablegrid

EditableGrid is an open source Javascript library aimed at turning HTML tables into advanced editable components. It focuses on simplicity: only a few lines of code are required to get your first table up and running.
http://www.editablegrid.net
Other
795 stars 272 forks source link

Error while adding field from Add form #180

Open Samadhan1012 opened 7 years ago

Samadhan1012 commented 7 years ago

I want to add one more field height value from Add Form page along with existing name and firstname. So I have added code accordingly but gets error. Please correct me. Index.html: ` <select id="height" names ="height" class="js-example-basic-single" type="text" style="width:50%" placeholder = "";'>

    <option value="System Test">System Test</option>
    <option value="Early FPV">Early FPV</option>
    <option value="FPV">FPV</option>
  </select>`

add.php: `$name = $mysqli->real_escape_string(strip_tags($_POST['name'])); $firstname = $mysqli->real_escape_string(strip_tags($_POST['firstname'])); $age = 20; $lastvisit = date('Y/m/d'); $height = $mysqli->real_escape_string(strip_tags($_POST['height'])); $tablename = $mysqli->real_escape_string(strip_tags($_POST['tablename']));

$return=false; if ( $stmt = $mysqli->prepare("INSERT INTO ".$tablename." (name, firstname, age, lastvisit, height) VALUES ( ?, ?, ?, ?, ?)")) {

$stmt->bind_param("sssss", $name, $firstname, $age, $lastvisit, $height);`

loaddata.php: $grid->addColumn('height', 'Height', 'string'); demo.js: ` data: { tablename : self.editableGrid.name, name: $("#name").val(), firstname: $("#firstname").val(), height: $("#height").val() }, success: function (response) { if (response == "ok" ) {

            // hide form
            showAddForm();   
            $("#name").val('');
            $("#firstname").val('');
            $("#height").val('');
            message("success","Record added successfully.");
            self.fetchGrid();`

MySql database: `height | varchar(30) | latin1_swedish_ci |   | Yes | NULL'

jakobl commented 6 years ago

i am facing the same problem. Have you found a solution?