I need to send some POST data using jquery-ui selectable in a form.
Checked object will be stored in my database after clicking "Aggiorna
" button.
I use the external Checked()
function to preleve the last configuration by my database in order to dinamically choose the default selected items.
if(isset($_POST['Aggiorna'])) // button name
{
global $Gruppo_Sensori,$Gruppo_Elettrovalvole,$id_GS,$id_GE, $G;
// recupero le informazioni dal form
for($i=0;$i<count($G); $i++)
{
if(isset($_POST[$G[$i]]))
{
// UPLOAD $_POST[$G[$i]] on my database
unset($_POST[$G[$i]]); // clear the $_POST data
}
}
echo "<form action='' method='POST' name='programmazione' id='programmazione'>";
echo"<table>";
for($j=0;$j<7;$j++)
{
echo "<tr>";
echo"<td>$G[$j]</td>";
echo"<td>";
for($i=0;$i<24;$i++)
{
$k=$i+1; //calcolo l'estremo superiore dell'intervallo
$value = array($j,$i,0,$j,$k,0);
$nome = $G[$j];
if(Checked($j,$i,0,$j,$k,0)) {
$checked = "checked";
} else {
$checked="";
}
echo "<input type='checkbox' name='$nome"."[]' value='". implode(',',$value). "' $checked/> $i:$k";
}
echo"</td>";
echo "</tr>";
}
echo"</table>";
echo "<tr><td></td><td><input type='submit' value='Aggiorna' name='Aggiorna'></input>
This code works, but now I would like to use jquery to do the same work, for a obviuos graphical reason. I have replaced the checkbox with
if(Checked($j,$i,$Minuto,$Giorno_Finale,$Ora_Finale,$Minuto_Finale))
{
echo "<li class='ui-state-default ui-selected' id='$id'>$i</li>"; // selected
$_POST[$nome][] = implode(',',$value); // adding items to $_POST in order to reinsert it on database
}
else
{
echo "<li class='ui-state-default' id='$id'>$i</li>"; // unselected
}
I can't understand why it don't work
An other problem will be to add other option than the defaults to $_POST
using jquery
A demo is visible here under Programmazione tabs >> clicking on Clock images
User: guest, pass: guest
Thank you very much for your support