How can I store my data.. if you test the code…
you must add one by one field
… you will found the problem… it can’t save the previous entry.. for example if i store 2 in one field.. when I enter next number and click Add it will delete previous…
<?php
$puzzle = array(0,0,6,4,3,2,0,5,3,0,0,6,4,4,0,0,0,0,1,3,0,0,0,0,2,6,4,0,0,1,3,0,1,3,4,5,0);
$solved = array(0,1,6,4,3,2,5,5,3,2,1,6,4,4,2,6,5,3,1,3,5,1,6,4,2,6,4,5,2,1,3,2,1,3,4,5,6);
for($i=1;$i<=36;$i ){
if($_POST['field'.$i]!=''){
$puzzle[$i] = $_POST['field'.$i];
break;
}
}
class displayClass {
public function display($field){
$fieldNum=0;
$puzzle=$field;
GLOBAL $ids , $edited;
$ids = array(0);
echo "<form action=\"index.php\" method=\"post\"><table border = \"3\" ><tr>" ;
for($i=1;$i<=36;$i ){
if($puzzle[$i]==0){
$ids[] = $i;
echo "<td><input type=\"text\" name=\"field".$i."\" maxlength=\"1\" size=\"1\"/></td>";
} else {
echo "<td>".$puzzle[$i]."</td>";
}
if($i%6==0){
echo "</tr><tr>";
}
}
echo "</td></table>";
}
}
displayClass::display($puzzle) ;
echo "<input type=\"submit\" value=\"Add\" /></form>";
?>
And also I am havig huge problem with formating questions..did the most of editing availabe..
I think you should post your code here instead of linking to it. I don’t know about most people, but it will probably dissuade them. Also, I’m having a hard time understanding what you want. I’m assuming what you are doing is overwritting a variable, and you wish to keep each value. Try using an array and setting it to a session variable like so.