Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while adding field from Add form #180

Open
Samadhan1012 opened this issue Sep 5, 2017 · 1 comment
Open

Error while adding field from Add form #180

Samadhan1012 opened this issue Sep 5, 2017 · 1 comment

Comments

@Samadhan1012
Copy link

Samadhan1012 commented Sep 5, 2017

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></option> <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
Copy link

jakobl commented Nov 11, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants