display_crud($_GET['id']); //var_dump($result); $count = sizeof($result); }else{ $msg = "Please send an id"; header("Location:display.php?msg=".$msg); } if(isset($_POST['submit']) && $_POST['submit'] = "save") { //check if both post values(name and age) are set or not empty if( ($_POST['name']!="") && ($_POST['age'] !="") ) { var_dump($_POST); $result = $crud_object->update_CRUD($_POST); if ($result) { $msg = "Inserted new data succcessfully."; header("Location:display.php?msg=".$msg); } }else { //if name is empty set error if($_POST['name']=="" || !isset($_POST['name'])) { $name_error = "Name is required."; } //if age is empty set error if($_POST['age']=="" || !isset($_POST['age'])) { $age_error = "Age is required."; } } } ?> 0) { for($i=0;$i<$count; $i++){ ?>