C'è qualche problema nel codice ma ci sono quasi:
HTML
Codice PHP:
<input type="checkbox" name="objectlist[]" id="checkbox1" value="1" onclick="addcheckbox(1);"/>
<input type="text" name="orderlist[]" id="text1" value="" size="1"/>
<input type="checkbox" name="objectlist[]" id="checkbox2" value="2" onclick="addcheckbox(2);"/>
<input type="text" name="orderlist[]" id="text2" value="" size="1"/>
JS (per l'interazione con la text)
Codice PHP:
var i=0;
function addcheckbox(id){
if (document.getElementById){
text = document.getElementById("text"+id);
if (document.getElementById("checkbox"+id).checked) {
i++;
text.value=i;
}else{
i--;
text.value="";
}
}
}
PHP
Codice PHP:
$ord = $HTTP_POST_VARS['orderlist'];
$check_ordered = array ();
asort ($ord);
reset ($ord);
while (list($k, $v) = each ($ord))
{
if (is_numeric($v))
array_push ($check_ordered, $k);
}
//Poi ordino la Objectlist secondo gli elementi della Orderlist
Che ne dite qual'è il problema?