Forum Moderators: coopster
i want to achive this:
- page 1; has 2 items on it with checkboxes. Now i can select 1, 2, both or none.
- page 2; has 2 items also with checkboxes. Again i can select 1, 2, both or none.
On 3rd page i have an email form with the listed data selected on first 2 pages. when i fillout the form i send it to my email with the selected items.
Its like a simple shoppingcart thing.
Everyone told me to use session, but honestly, i dont know how to pull this off. now i have a contact form on both 2 pages and i have to fill out the form on both pages if i want to send the selected data to my email if i have selected something on the page ...
If anyone is willing to help me out with a simple example on how to store checkbox data in a session i will be more than grateful.
best regards,
heki
<form action="page2.php">
<input type="checkbox" name="item1">Item 1
<br>
<input type="checkbox" name="item2">Item 2
<br>
<input type="submit" value="send">
</form>
<?php
session_start();
$_SESSION['item1'] = $_POST['item1'];
$_SESSION['item2'] = $_POST['item2'];
?>
<form action="page2.php">
<input type="checkbox" name="item3">Item 3
<br>
<input type="checkbox" name="item4">Item 4
<br>
<input type="submit" value="send">
</form>
<?php
session_start();
$item1 = $_SESSION['item1'];
$item2 = $_SESSION['item2'];
$item3 = $_POST['item3'];
$item4 = $_POST['item4'];
?>