Accessing user input My question is basically how to access values that the user entered in previous forms. For example, I am using drupal commerce and as the user sees a product, fills some text field values and clicks add to cart and then finishes the checkout. At the end of the checkout how can i access programatically  the values that he entered in the first stage of the process?

One way I think it might work, is to add a submit handler in the  original product form that "grabs" the values when he clicks add to cart and then save them to a session. Is this the correct way ?  Is there any other way like querying  the db or something?

I do not want to display to the user anything, I just want to work "behind the scenes".For  Example after the checkout is complete, I want to call the hooK_commerce_checkout_complete and by using the values that he entered in the first place modify and save a pdf (I know how to crate the pdf with  the tcpdf lib what i do not know is how to  call the values as i said earlier).

If this were Java the values would correspond to an instance variable and i would have access through the corresponding get method. Surely there must be something equivalent for this in php/drupal.  

I would appreciate any advice or links to the proper documentation on how to do that.

PS I am most interested on accessing commerce  line items  and the value of their fields but i should probably start with the easy ones first!

Thanks in advance
PHP isn't Java...there's no concept of 'instance variables' in this context, and no automatic persistence of such vars across page requests. 

Drupal Commerce persists information about the order, order lines, products, etc to the database during the checkout process, and then re-loads the relevant entity when it needs it (which is the standard workflow).

In hook_commerce_checkout_complete() you already have access to the $order entity, so there's no need to load it yourself. I'd advise using an entity_metadata_wrapper() to access the order; to get the order lines, for example, you'd use something like:

function MYMODULE_commerce_checkout_complete($order) {
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  foreach ($order_wrapper-&gt;commerce_line_items as $line_item_wrapper) {
    // Do something with $line_item_wrapper.
    $field_val = $line_item_wrapper-&gt;field_something-&gt;value();
  }
}