I am trying to create small shopping cart without sql database. My products are in directory and getting the files with foreach script, wich is working..
how can I set variables to var1, var2 var3 and so on, with each products
should i use if var1 isset in each product1.php files. and now when I think it would be best if the varX is set by the filename of the each product, as the product1.php can be someproduct.php also.( the X would be the filename)
the someproduct1.php someelseproduxt.php is listed below each other on the page
and the second question. I would put the "add to cart" link to every product page so the $varX would be reset as $cart_varX and the shopping cart "module" has if isset
which checks the if the buyer has added it to the cart. So the question is how can I use <a href=""></a>
to use to set variables and return to page where is the link clicked?
but if the variables is filename based the .php would be nice get of, but not necessery
First off, all of this sounds really ugly and it seems that you are very unsure about php basics, which leads to the question whether or not you should develop a shopping cart application.
Furthermore, i would strongly recommend you to use some kind of dbms or storage system to perform complex queries for your products later.
However if you want to specify the product details in single php files (which -again- i think is a bad idea) you'll should probably use a shared multidimensional array where every product has its own unique key.