prepare('SELECT id FROM locations WHERE name = ?'); $stmt->execute([$name]); if ($stmt->fetch()) { $error_message = 'A location with this name already exists.'; } else { $sql = "INSERT INTO locations (name) VALUES (?)"; $stmt = $pdo->prepare($sql); $stmt->execute([$name]); header("Location: locations.php?success=location_added"); exit; } } catch (PDOException $e) { $error_message = 'Database error: ' . $e->getMessage(); } } } ?> Add New Location - IC-Inventory

Add New Location

Cancel