Hello, this is an example, its doing with session:
<?
session_start();
if($_POST["Clear"]=="Reset")
{
$_SESSION["on_start"]=0;
$_SESSION["list_el"]="";
$_SESSION["rlist_el"]="";
header("Location: ".$_SERVER['PHP_SELF']);
}
check();
checkr();
if($_SESSION["on_start"]==0) // if its the firts step into the site, lets fill the array...
{
$_SESSION["on_start"]=1;
$_SESSION["list_el"][]="a";
$_SESSION["list_el"][]="b";
$_SESSION["list_el"][]="c";
$_SESSION["list_el"][]="d";
$_SESSION["rlist_el"][]="e";
$_SESSION["rlist_el"][]="f";
$_SESSION["rlist_el"][]="g";
$_SESSION["rlist_el"][]="h";
}
function check($r)
{
if($_POST["list_el"])
{
foreach($_POST["list_el"] AS $rows)
{
$_SESSION["rlist_el"][]= $_SESSION["list_el"][$rows];
$_SESSION["list_el"][$rows]="";
}
}
}
function checkr($r) //check if there was a post from the right side
{
if($_POST["rlist_el"])
{
foreach($_POST["rlist_el"] AS $rows)
{
$_SESSION["list_el"][]= $_SESSION["rlist_el"][$rows];
$_SESSION["rlist_el"][$rows]="";
}
}
}
function make($var,$name)
{
print '<td>';
print ' <select name="'.$name.'[]" size="5" multiple id="'.$name.'[]">';
$i=0;
foreach($var AS $rows)
{
if($rows) //if its value is not null,
{
print '<option value="'.$i.'">'.$rows.'</option>';
}
$i++;
}
print '</select>';
print '</td>';
}
print "<table border='1'>";
print '<form name="name" method="post" action="?">';
print '<tr>';
make($_SESSION["list_el"],"list_el");
make($_SESSION["rlist_el"],"rlist_el");
print '</tr>';
print '<tr><td align="center"><input type="submit" name="Real Submit" value="Submit"></td>
<td align="center"><input type="submit" name="Clear" value="Reset"></td>
</tr>';
print '</form>';
print '</table>';
?>
denzlite;10891267 wrote:I'm not even sure I know the proper terms of this - which make it hard to google around. If someone could tell me in PHP terms:::>>
I'd like to have two lists of things side by side and be able to ctrl or shift select one or more items on the right - clicking submit would send those items to the left. I've been able to put together a simple select dropdown, but don't know what the php speak for doing this is 😉
Thanks!