Hi

Im trying to create a web based quotation system with php and mysql.

I wanted to create something like shopping basket where people store the items and when they click generate quote the system will display the quote of the items and qty selected. Only when the person has clicked generate quote I wanted to store the quote on the system.

I was thinking to store the items and qty in the session until the person has clicked generate quote.

so finally my question. Is it ok to store the items and qty the user has selected in the session until they want to generate quote.

meaning

$a_temp = array(array('item1'=>'name1', 'qty1'=>1), 
                array('item2'=>'item2', 'qty'=>2), 
                array('item3'=>'item3', 'qty'=>3));

$_SESSION['array'] = $a_temp;

when someone adds item to the quote I would just do the following:

  $s_array = $_SESSION['array'];
  array_push($_SESSION['array'], array("new_item_added"=>"new_item", 'new_qty_added'=>4));

Just wanted to check if I'm doing the right thing.
and how much info can be stored in the session.

Virtually there is no limit, the session file will be stored in a server directory or into a database (if you configure it). But you have to check memory_limit in php.ini because the script will stop if you get over:

http://www.php.net/manual/en/ini.core.php#ini.memory-limit

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.