ok guys
i'm still having the same problem
so it would be nice if someone could find out what's going wrong ...
so my aim is to display some rows coming from a mysql table. In front of each line i should display a checkbox.
so i use an arraynamed val[] to submit my checkbox
this checkbox should users to update rows by checking the rows he wants to update.
so when the form is submitted i do my query & my update
....
let's see my code :
<?php
if (isset($Submit)) {
if (count($val) > 0) {
for ($i=0;$i<count($val);$i++) {
mysql_connect($host, $user,$password) or die("Unable to connect to server");
mysql_select_db($bdd) or die("Unable to select database");
$result = mysql_query("Update mytable set DELETED='O' Where keycolumn = '$val[$i]'");
//here it's supposed to delete only the rows which were checked
mysql_close(); }
echo "All record has been updated\n"; }
}
?>
then i print out my html stuff (my <table>)
<TITLE>LISTE</TITLE>
</HEAD>
<BODY bgcolor="#FFFAFF">
<FORM ACTION="<? echo $PHP_SELF;?>" METHOD="POST"> // i get on the same script
<TABLE border=0 cellpadding=0 cellspacing=0 width="100%">
<b>  Liste</b>
</font>
</TD>
</TR>
</TABLE>
<BR>
<A HREF="/path/back.php">back</A>
<BR><BR>
<TABLE border=2 cellpadding=2 cellspacing=0>
<TR>
<TH align=center bgcolor=#EEDDCC>
<FONT face="arial, helvetica">
keycolumn
</FONT>
</TH>
<TH align=center bgcolor=#EEDDCC>
<FONT face="arial, helvetica">
column2
</FONT>
</TH>
<TH align=center bgcolor=#EEDDCC>
<FONT face="arial, helvetica">
column3
</FONT>
</TH>
<TH align=center bgcolor=#EEDDCC>
<FONT face="arial, helvetica">
column4
</FONT>
</TH>
<TH align=center bgcolor=#EEDDCC>
<FONT face="arial, helvetica">
column5
</FONT>
</TH>
<TH align=center bgcolor=#EEDDCC>
<FONT face="arial, helvetica">
column6
</FONT>
</TH>
<TH align=center bgcolor=#EEDDCC>
<FONT face="arial, helvetica">
column7
</FONT>
</TH>
<TH align=center bgcolor=#EEDDCC>
<FONT face="arial, helvetica">
mycheckbox
</FONT>
</TH>
// then i'm suppose to display my rows by showing my query's result
<?php
mysql_connect($host, $user,$password) or die('Unable to connect to erver . ');
$query = "SELECT keycolumn,column2,column3,column4,column5,column6,column7 FROM mytable where DELETED='N'";
mysql_select_db($bdd) or die('Unable to select database .');
$result = mysql_query($query);
if (mysql_num_rows($result) != 0) {
for ($i=0;$i<mysql_num_rows($result); $i++) {
$row = mysql_fetch_row($result);
$keycolumn = $row[0];
$column2 = $row[1];
$column3 = $row[2];
$column4 = $row[3];
$column5 = $row[4];
$column6 = $row[5];
$column7 = $row[6];
?>
<DIV ALIGN="center">
<tr>
<td><a href="/path/forward.php?keycolumn=<?php echo $keycolumn ?> "> <?php echo $keycolumn ?> </a></td>
<td><?php echo $column2 ?></td>
<td><?php echo $column3 ?></td>
<td><?php echo $column4 ?></td>
<td><?php echo $column5 ?></td>
<td><?php echo $column6 ?></td>
<td><?php echo $column7 ?></td>
<td><INPUT TYPE=checkbox NAME=vals[] VALUE=<?php echo $keycolumn ?> ></td><br> //as my value is $keycolumn when i'll submit it's suppose to keep only the id of checked rows
</tr>
</DIV>
<?php
}
mysql_close();
}
?>
</TABLE>
<BR><BR>
<DIV ALIGN="center">
<INPUT TYPE="submit" VALUE="Submit" NAME="Submit">
</DIV>
</FORM>
</BODY>
that's my entire code
everything seems ok i've read mails everywhere but still no answers
in fact i'm surpised cause when i typed :
echo count($val) at the top of my script i get 0 after the submit => it means that nothing is submitted in the array ?
it's urgent & i'm going mad about it
so help would be welcomed