Can anyone please help me to better understand how parameters are passed between pages?

The example I'm looking at is adding a product to the shopping cart from a product page.

On the Product Page, the HTML form behind the “Add to Cart” button (as shown in View Source) shows the Action as:

Code:
<form name="cart_quantity" action="http://example.com/index.php?main_page=product_info&amp;cPath=0&amp;products_id=34&amp;action=add_product" method="post" enctype="multipart/form-data"><input type="hidden" name="securityToken" value="2d9dd751a811a5be15fe2f053a2ae3b9" />
This says three things to me:
  • The method for transferring data is POST
  • The 'action' value being passed is “add_product”
  • The products_id (for identifying the product) is being passed.

I would therefore have expected a POST array to be picked up by a PHP script and used to progress the shopping cart process. However, I can't seem to work out how this happens.

My testing seems to show that the array of data is received in 'init_cart_handler.php', specifically in the “if (isset($_GET['action'])) {” conditional loop. I say this because I traced the shopping cart functionality back through 'shopping_cart.php' to 'main_cart_actions.php' to 'init_cart_handler.php'.

But by the time the array has made it through to 'shopping_cart.php', it is being referred to as a POST array.


The reason I ask is because I am altering the visible URLs using .htaccess re-writes. According to Apache logs, an “un-rewritten” URL is received as follows:
blah...
Request:
Code:
"POST /index.php?main_page=product_info&cPath=0&products_id=34&action=add_product HTTP/1.1"
...blah...
Referrer:
Code:
"http://example.com/index.php?main_page=product_info&cPath=0&products_id=34"
...blah

whereas the re-written URL is received as:

blah...
Request:
Code:
"POST /index.php?main_page=product_info&cPath=0&products_id=34&action=add_product HTTP/1.1"
...blah...
Referrer:
Code:
"http://example.com/A-product-name"
...blah

The Request is the same. Only the referrer is different, yet one successfully initiates a purchase and the other just reloads the same page. This is where I'm confused. With no difference in the POST string being received by the server, why are the two requests being treated differently?


Can anyone help me to understand the mechanics here please?


PS:
v1.5.1
No mods
No Apache errors
No “myDEBUG...” errors.