On my page here: page, you can create a tutorial. If the tutorial author = ', the php code wont write the value's of the field's into the database. I checked the table of the database again and its 100% correct (varchar & 20 characters for the author). I collect all value's of the inputfield's with jquery and use Ajax to send it to my php code (that works too). Here is the code of the php page:
<?php
$step_counter = 1;
$tutorial_id = null;
print_r($_POST);
if(isset($_POST['input_tutorialtitle_name']) && isset($_POST['input_tutorialauthor_name']) && isset($_POST['input_tutorialdescription_name'])){
$title_value = $_POST['input_tutorialtitle_name'];
$author_value = $_POST['input_tutorialauthor_name'];
$description_value = $_POST['input_tutorialdescription_name'];
$insert = "INSERT INTO tutorial (tutorial_steps, tutorial_author, tutorial_title, tutorial_introduction) VALUES ('1', '$author_value', '$title_value', '$description_value')";
$insert_into_tutorial = mysqli_query($db, $insert);
if(!($insert_into_tutorial)){
print_r("Fehler beim eintragen des Tutorial's.");
}
else{
$tutorial_id = mysqli_insert_id($db);
}
}
$hit = true;
while($hit == true){
$input_title_name = "input_title_name" . $step_counter;
$input_description_name = "input_description_name" . $step_counter;
$input_image_name = "input_image_name" . $step_counter;
if(isset($_POST[$input_title_name]) && isset($_POST[$input_description_name])){
$input_title_value = $_POST[$input_title_name];
$input_description_value = $_POST[$input_description_name];
$input_image_width = 0;
$input_image_height = 0;
$input_image_value = 0;
if(isset($_POST[$input_image_name])){
$input_image_value = $_POST[$input_image_name];
list($width, $height) = getimagesize($input_image_value);
$input_image_height = $height;
$input_image_width = $width;
}
$insert = "INSERT INTO tutorial_step (tutorial_id, tutorial_step_number, tutorial_step_title, tutorial_step_image_name, tutorial_step_image_height, tutorial_step_image_width, tutorial_step_description) VALUES ('$tutorial_id', '$step_counter', '$input_title_value', '$input_image_value', '$input_image_height', '$input_image_width', '$input_description_value')";
$insert_into_tutorial_step = mysqli_query($db, $insert);
if(!($insert_into_tutorial_step)){
print_r("Fehler beim eintrages des Schrittes.");
}
$step_counter = $step_counter + 1;
$hit = true;
}
else{
$hit = false;
}
}
?>
And here is the image of the error (i used Firebug (if you try it too, you can see the entered value's)).
(line 14)
As example, I enter this value's:
, no error & php wrote it into the database table.