hii
i have one form in which i print records from mysql database. while 
displyaing those records i display one checkbox with each record. i want the 
user should select the checkbox corresponding to the record which s/he wants 
to delete.

i display those records after running one query. hence each time no.of 
records are diff. so its difficult to hard code names for check boxes. for 
name attribute in <input type=checkbox> tag, i define one array. having same 
name as the key field in the table. and value for which is also set 
dynamically.

<FORM NAME = "act_qmd_subj_frm" METHOD = "POST" ACTION = 
"confirm_delete.php">

while ($row = mysql_fetch_array($result))
     {

        ......
         echo "<tr>";

       //call function to display the contents of $row in table
        print_entry($row,"subj_id","subj_name","subj_desc");


        print "  <td valign=top align=center><input type=checkbox  
name=\"subj_id[]\" value=\"".$row["subj_id"]."\"> Yes, delete entry 
#".$row["subj_id"]."</td>\n";

      .......

     }

     <INPUT TYPE="submit" NAME="del_but" VALUE="Delete"> &nbsp &nbsp
     <INPUT TYPE="submit" NAME="modify_but" VALUE="Modify"> &nbsp &nbsp
     <INPUT TYPE="reset" NAME="clear_but" VALUE="Clear"> &nbsp &nbsp

</FORM>

when i submit the form to confirm_delete.php i run one code there to print 
the array subj_id[]  which is supposed to contain values of the checkboxes 
which are selected to delete or to modify. but the array subj_id[] contains 
no value at all. echo count($subj_id) gives 0.

is there any other way to pass multiple checkbox values from the form???

i got the above trick from the book "MySQL/PHP Database Applications" (By, 
Jay Grrenspan and Brad Bulger) in one script they have passed checkbox value 
thru array by this way, and its working fine.

can anyone PLS figure out what wrong im doing???

thnx and regds,
smita.



_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to