$from = $_POST['old']; $to = $_POST['new']; $sql = "UPDATE Categories SET CategoryName='$to' WHERE CategoryName='$from'"; $count = $pdo->exec($sql);