|
Posted by Nico on 12/15/06 11:26
Hi all,
I've created the following code:
<?php
session_start();
?>
<FORM METHOD="POST" ACTION="prova.php">
Add <b>Combination</b><br><br>
Element 1: <INPUT NAME="el1add" TYPE="TEXT">
<BR>
Element 2: <INPUT NAME="el2add" TYPE="TEXT">
<br>
<INPUT TYPE="SUBMIT" VALUE"Submit">
</FORM>
<br>
<FORM METHOD="POST" ACTION="prova.php">
Del <b>Combination</b><br><br>
Element 1: <INPUT NAME="el1del" TYPE="TEXT">
<BR>
Element 2: <INPUT NAME="el2del" TYPE="TEXT">
<br>
<INPUT TYPE="SUBMIT" VALUE"Submit">
</FORM>
<br><br>
Combination<br><br>
<?php
$_SESSION["combinations"][] =
($_REQUEST["el1add"].$_REQUEST["el2add"]);
unset($_SESSION["combinations"][$_REQUEST["$el1del"]]);
unset($_SESSION["combinations"][$_REQUEST["$el2del"]]);
print_r($_SESSION["combinations"]);
?>
I'd like to create an array combinations which includes all the
combinations that I insert through the first form (add combinations).
ref:
$_SESSION["combinations"][] = ($_REQUEST["el1add"].$_REQUEST["el2add"]);
This works fine and is OK.
Then, I'd like to delete from the array combinations all the
combinations that I insert through the second form (del combinations).
ref:
unset($_SESSION["combinations"][$_REQUEST["$el1del"]]);
unset($_SESSION["combinations"][$_REQUEST["$el2del"]]);
This second part doesn't work.
In particular, I want to delete all the elements of the array
$_SESSION["combinations"] that include $_REQUEST["$el1del"] or
$_REQUEST["$el2del"] as text (not as key). I've some problem in doing it.
Can you help me please?
Many thanks.
Cheers,
Nico
Navigation:
[Reply to this message]
|