var_dump($_POST); $auth->require_login(); if(!isset($_GET['id']) || !is_numeric($_GET['id'])) redirect_to_url('/items/view_items.php'); //Redirect to inventory page. $item_id = (int)$_GET['id']; $item = new Item($item_id); if($item->get_owner_id() != $user_id) redirect_to_url('/items/view_items.php'); //Redirect to inventory page. if(isset($_POST['name'])){ //form was submitted $name = $db->escape_string($_POST['name']); $location = $db->escape_string($_POST['location']); $item->set_name($name); $item->set_location($location); if(isset($_POST['attributes'])){ $attributes = $_POST['attributes']; foreach($attributes as $attribute){ $attribute_id = (int)$attribute['id']; $value = $db->escape_string($attribute['value']); //echo "ID: $attribute_id V: $value"; $new_attribute = new Attribute($item_id, $attribute_id); $new_attribute->set_value($value); } } redirect_to_url("/items/item.php?id=$item_id"); }