Jump to content

Adding form variables into session cart


petenaylor

Recommended Posts

Hi all

 

I have a php form as follows:

 

<form action="basket.php?action=add&id=1&qty=1" method="post" name="buy-product">

<input name="initial_1" id="initial_1" type="text" size="8" maxlength="1" />

<input name="initial_2" id="initial_2" type="text" size="8" maxlength="1"  />

<input name="initial_3" id="initial_3" type="text" size="8" maxlength="1"  />

<input name="send" type="submit" class="contact-form-button" id="send" value="Submit" />

 

Basically I need to add the three initials into a session so that they can be shown in the shopping cart next to the product.

 

How do I add the initials to the session and how do I output them to the shopping cart?

 

At the start of my basket.php script I have:

 

$cart = $_SESSION['cart'];

$action = $_GET['action'];

$id = $_GET['id'];

$qty = $_GET['qty'];

$initial_1 = $_POST['initial_1'];

$initial_2 = $_POST['initial_2'];

$initial_3 = $_POST['initial_3'];

 

I now need to create a table with the cart showing item, price and initials.

 

Cheers

Pete.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.