title: How to use HttpContext to obtain value of int instead of string?
body: <p>I have the current line that requests a product # from a text box:</p>
  
  <pre><code> string[] productNumbers = HttpContext.Current.Request.Form.GetValues("ProductNumber");
  </code></pre>
  
  <p>I attempted to adapt it to obtain the value from Qty as well:</p>
  
  <pre><code> int[] qty = HttpContext.Current.Request.Form.GetValues("quantity_input");
  </code></pre>
  
  <p>But I receive an error that it is unable to convert string to int. So how can I use this go obtain an Int? I just want to grab it.</p>
  
  <blockquote>
    <p>"CS0029: Cannot implicitly convert type 'string[]' to 'int'"</p>
  </blockquote>
  
  <p>My full code is: </p>
  
  <pre><code>CartItemCollection items = new CartItemCollection();
  Cart cart = Core.GetCartObject();
  string skus = "";
  string debugStr = "";
  Product product = null;
  int[] qty = HttpContext.Current.Request.Form.GetValues("quantity_input");
  try
  {
      string[] productNumbers = HttpContext.Current.Request.Form.GetValues("ProductNumber");
      foreach (string productNumber in productNumbers)
      {
          debugStr = debugStr + "-p=" + productNumber;
          if(!string.IsNullOrEmpty(productNumber.Trim()) &amp;&amp; !productNumber.StartsWith("Enter Product #"))
          {
              try
              {   //redirect if no product found
                  product = Core.GetProductObjectByProductNumber(productNumber);
              }
              catch (Exception e)
              {
                  debugStr = debugStr + "-e=noproductfound";
                  continue; //do nothing, process the next user input
              }
              //check if we have a valid product object, allow virtual and other type(s) for adding directly to cart which may need special handling
              if(product != null)
              {
                  debugStr = debugStr + "-t=" + product.ProductTypeName;
                  if(!product.ProductTypeName.Equals("NORMAL"))
                  {
                      //assume VIRTUAL (or other type) and redirect for selecting child/group products or other special handling
                      form.Redirect("product.aspx?p=" + product.ProductNumber);
                  }
                  else
                  {
                      debugStr = debugStr + "-a=noattributesadd";
                      CartItem item = new CartItem(context);
                      item.ProductId = product.ProductId;
                      item.Quantity = qty;
                      items.Add(item);
                  }
                  skus = skus + ";" + productNumber;
                  product = null;  //reset the product object in case the next product number submitted is invalid
              }  //product not null
          }  //sanity check for empty or default data
      }  //iterate on each product submitted
      cart.AddItems(items);
      form.Redirect("cart.aspx?skus=" + skus);
  }
  catch (Exception e)
  {
      form.AddError("*** ProductNumber provided was not found ***");
      form.Redirect("quickorder.aspx?qo=2&amp;e=" + e.Message);
      return;
  }
  </code></pre>