PDA

View Full Version : dynamic insert of mutiple checkboxes


lux
11-13-2006, 02:58 PM
Hey there people,

I have 3 tables: tbl_dept -< tbl_deptprinter >- tbl_printer.

I want to add a new dept and assign some of the printers to that department. The table tbl_deptprinter has two cols which reference tbl_dept & tbl_printer.

The form below returns the printers from tbl_printer with checkboes and a unique arrary name for each.

Im now stuck as to how to insert the ticked checkboxes based on the users input into the composite table (tbl_deptprinter).

would anybody be able to help me? thank you

<form action="processtest3.php" method="post">
<?php
include("connection.php");

$sql = "select * from tbl_printer";
$pResult=mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($pResult) == 0)
{
print "There are No Records";
}
else
{
while($tmp = mysql_fetch_assoc($pResult))
{
echo $tmp['printerName'];
echo "<input type=\"checkbox\" name=\"NA[]\" value=\"".$tmp["printerId"]."\">";
echo $tmp['printerId'];
echo "<br />";
}
}
?>
<input name="Submit" type="submit" class="button" value="Go !" />
</form>

davidj
11-13-2006, 03:54 PM
ok

you are on the right lines

when you submit the form you have you have already set the form name as an array - Great

when you submit the form wrap your insert statement in a FOR loop...

example...This will add 4 lines if there are 4 check boxes ticked


<?php

$checkbox = $_POST['checkbox']; // catch array checkbox

$count = count($checkbox); // count size of array

for (i=0; $count < i; i++){ // this loop will poll as many times as you have checked boxes that = ticked

// *********** Insert statement here **************** //

}

?>

//////////////// FORM //////////////////////////////////
<body>
<form id="form1" name="form1" method="post" action="">
<input name="checkbox[]" type="checkbox" id="checkbox[]" value="1" />
<input name="checkbox[]" type="checkbox" id="checkbox[]" value="1" />
<input name="checkbox[]" type="checkbox" id="checkbox[]" value="1" />
<input name="checkbox[]" type="checkbox" id="checkbox[]" value="1" />
<input name="checkbox[]" type="checkbox" id="checkbox[]" value="1" />
<input name="checkbox[]" type="checkbox" id="checkbox[]" value="1" />
<input type="submit" name="Submit" value="Submit" />
</form>
</body>

lux
11-14-2006, 09:37 AM
thanks davidj

also, would you know how i would use this function:

mysql_insert_id();

as i have set up my pages so that i have the form with the above code which is submitted to a process.php page where an sql statement is executed to add the record and then another script takes the printer values from the array:


<?php include("connection.php"); ?>

<?php

$sql="INSERT INTO tbl_dept (deptName, description, deptBal, minBal) VALUES('$_POST[deptName]', '$_POST[description]', '$_POST[deptBal]', '$_POST[minBal]');";

if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
echo "<br />";

?>

<?php
$deptid = mysql_insert_id();

$records = array();
if (is_array($_POST['NA'])) {
foreach ($_POST['NA'] as $printer_id) {
// assuming printer_id is a number
if (!ctype_digit($printer_id)) {
die('something wrong, these should all be numbers...');
}
$records[] = "($dept_id, $printer_id)";
}

$sql = "INSERT INTO tbl_deptprinter (deptRef, printerRef) VALUES ";
$sql .= implode(', ', $records);
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
echo "<br />";
} else {
echo "no printers submitted";
}

?>

davidj
11-14-2006, 09:45 AM
mysql_insert_id() is written after your insert statement and will return the last id from an auto incrementing id field


************************************
** INSERT SQL statement here *******
************************************

$id = mysql_insert_id(); // gets the last insert id


you could assign the $id to a session or add to an array for further processing

lux
11-14-2006, 10:16 AM
cool cool working now,

davidj and other forumers would it be cool to offer some guidence on updating the info in another form.

ill guess ill need to:

1. return the values from the database based on deptid (for dept name ect)
2. return all printers from printer list as i have done in the addPrinter.php
3. populate the checkboxes that are in the composite table (tbl_deptprinter)
4. change my insert sql statments in the process.php page to update and use $_post to obtain the values sent through from the submitted form.

so i guess the real question is how do i populate the checkboxes with the correct values from the composite table (tbl_deptprinter) ?

any suggestions?

davidj
11-14-2006, 12:41 PM
ok

how is the checkbox values set in the table. Is it one row for all values

table_values (field checkbox) = 1,2,3,4,6,8 etc

or multiple rows for all values (1 value per row)

table_values (field checkbox) = 1
table_values (field checkbox) = 2
table_values (field checkbox) = 3

lux
11-14-2006, 12:50 PM
because it is a many to many realtion is setup the db as:

tbl_printer -< tbl_deptprinter >- tbl_dept

tbl_deptprinter has 2 cols: deptRef (f key to tbl_dept) printerRef (f key to tbl_printer)

when i add a dept the following code inserts a new row for each of the checkbozes which are CHECKED into tbl_deptprinter:


<?php


$records = array();
if (is_array($_POST['NA'])) {
foreach ($_POST['NA'] as $printer_id) {
// assuming printer_id is a number
if (!ctype_digit($printer_id)) {
die('something wrong, these should all be numbers...');
}
$records[] = "($dept_id, $printer_id)";
}

$sql = "INSERT INTO tbl_deptprinter (deptRef, printerRef) VALUES ";
$sql .= implode(', ', $records);
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
echo "<br />";
} else {
echo "no printers submitted";
}

?>


the checkboxes on the add dept form are created using:


<?php
include("connection.php");

$sql = "select * from tbl_printer";
$pResult=mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($pResult) == 0)
{
print "There are No Records";
}
else
{
while($tmp = mysql_fetch_assoc($pResult))
{
echo $tmp['printerName'];
echo "<input type=\"checkbox\" name=\"NA[]\" value=\"".$tmp["printerId"]."\">";
echo $tmp['printerId'];
echo "<br />";
}
}
?>

davidj
11-14-2006, 01:05 PM
ic

ok

where you have this ...

echo "<input type=\"checkbox\" name=\"NA[]\" value=\"".$tmp["printerId"]."\">";


inside your input type field do this

if(!(strcmp($tmp["printerId"], $row['database_field_name']))){echo "selected";}

example...
<input type="checkbox" name="NA[]" value="id123" if(!(strcmp($tmp["printerId"], $row['database_field_name']))){echo "selected";} >

hope this makes sense

lux
11-14-2006, 01:35 PM
i understand what you are doing (comparing the strings and if they match = selected).

Where i have used DreamWeaver before to update a form, say with a drop down referencing info from another table there have been 2 recordsets, one for the reference data (to be displayed in the drop down box) and one to retrieve the record required to be displayed in the form (using $_GET).

this sql statement retreives the refernece data i require i.e. the checkboxes for dept 1 that appear in the tbl_deptprinter table:


SELECT *
FROM tbl_deptprinter
LEFT JOIN (tbl_dept, tbl_printer)
ON (tbl_dept.deptId = tbl_deptprinter.deptRef
AND tbl_printer.printerId=tbl_deptprinter.printerRef)
where tbl_dept.deptId='1';


which is what i want. But i also need the other checkboxes that represent the other printers that have not been selected.

I hope this makes sense!

Getting there! hehe

davidj
11-14-2006, 01:39 PM
so you need to display every checkbox but only tick the ones that have been selected

is this it?

lux
11-14-2006, 01:41 PM
yeah, sorry if i didnt make it clear

sorry if ive wasted your time, my head is looping around so much i dont think im making sense! ahhh

davidj
11-14-2006, 01:45 PM
no worries
*************

ok when you display the page are the checkboxes displaying without ticks?

and you just want to add a tick to each one depending on whats in your db?

lux
11-14-2006, 01:51 PM
yup,

so at the moment i can display all printers from tbl_printers using


<?php
include("connection.php");



$sql = "select * from tbl_printer";
$pResult=mysql_query($sql) or die(mysql_error());


if(mysql_num_rows($pResult) == 0)
{
print "There are No Records";
}
else
{
while($tmp = mysql_fetch_assoc($pResult))
{
echo $tmp['printerName'];
echo "<input type=\"checkbox\" name=\"NA[]\" value=\"".$tmp["printerId"]."\">";
echo $tmp['printerId'];
echo "<br />";
}
}
?>


i can also display the printers for a particular dept CHECKED by joining tbl_deptprinter & tbl_printer using:


<?php
include("connection.php");

$sql = "SELECT *
FROM tbl_deptprinter
LEFT JOIN (tbl_dept, tbl_printer)
ON (tbl_dept.deptId = tbl_deptprinter.deptRef
AND tbl_printer.printerId=tbl_deptprinter.printerRef)
where tbl_dept.deptId='1';";
$pResult=mysql_query($sql) or die(mysql_error());




if(mysql_num_rows($pResult) == 0)
{
print "There are No Records";
}
else
{
while($tmp = mysql_fetch_assoc($pResult))
{
echo $tmp['printerName'];
echo "<input type=\"checkbox\" name=\"NA[]\" value=\"".$tmp["printerId"]."\" CHECKED>";
echo $tmp['printerId'];
echo "<br />";
}
}
?>

davidj
11-14-2006, 01:58 PM
so are you wanting to display all departments but display the ticked checkboxes as well as the unticked ones

lux
11-14-2006, 02:08 PM
one department but all printers with a checkbox for each.

e.g.

I will have a first form where i will list all departments. Here there will be a dynamic link to my update.php page where the departments details will be displayed in a form based on passing the deptId in the URL where the user will be able to edit the information.

As part of the update form I will need to list all printers from the printers table tbl_printers) where the user can select which printers they would like to be associated with their department whilst already showing which printers have already been associated with te department and deselect that printer if they wish to, or keep checked.

because one dept can many many printers and one printer can belong to many departments my db is setup this way:

tbl_printer -< tbl_deptprinter >- tbl_dept

tbl_deptprinter contains the cols refernceing the other 2 tables (their ids)

hope this is clear and thatnk you for your time

davidj
11-14-2006, 02:16 PM
i am slowly understanding

ok

can you see all the checkboxes you want to from your details page?

and your problem is that you want to populate them with ticks that need them

lux
11-14-2006, 02:23 PM
hehe this is why i cant solve the problem: icant even explain it clearly, sorry davidj.

departmentList.php -> update.php -> process.php ->

departmentList.php will list the name of each departments with a link to update the departments details (update form). Included in this form will be a list of printer names from the printers table with a checkbox by each name.

For those printers already associated with the department (assigned when the department was first created in another form) the checkboxes should be ticked(CHECKED) already. Those printers that are not should not have ticks in the boxes.

the process.php page will simply perform an UPDATE query based on the updated form information.

I would like to know how to display the checkboxes in the update.php form that are already associated with department with a tick in them.

hehe, think i got there!

davidj
11-14-2006, 02:28 PM
gotchya

<input type="checkbox" name="NA[]" value="id123" <?php if(!(strcmp(1, $row['database_field_name']))){echo "selected";} ?> >

insert the green bit in your input tag

lux
11-16-2006, 09:09 AM
-----Update department page------

Hey, so below is a description of my problem! If anyone could help that would be excellent.
And davidj, thank you for your efforts so far and apologies for my confusing posts beforehand.

------Aim-----

I would like to create a page to update a departments details, which include the printers that are associated with the department.

Because a department can have many printers and a printer can belong to more than one department I have created 3 db tables to cater for the relationships.

-----DB Design--------

create table tbl_dept (
deptId int NOT NULL AUTO_INCREMENT,
deptName varchar(100),
description varchar(255),
deptBal float,
minBal float,
PRIMARY KEY (deptId)
);

create table tbl_printer (
printerId int NOT NULL AUTO_INCREMENT,
printerName varchar(100),
hostname varchar(100),
manufactuer varchar(255),
monochrome boolean,

PRIMARY KEY (printerId)
);

create table tbl_deptPrinter (
printerRef int,
deptRef int,
FOREIGN KEY (printerRef) REFERENCES tbl_printer(printerId),
FOREIGN KEY (deptRef) REFERENCES tbl_dept(deptId)
);

INSERT INTO tbl_dept (deptName, description, deptBal, minBal) VALUES('Dept A', 'Department a does a lot of work', 100.00, 5.00);
INSERT INTO tbl_dept (deptName, description, deptBal, minBal) VALUES('Dept B', 'Department b does a fair amount of work', 70.00, 5.00);
INSERT INTO tbl_dept (deptName, description, deptBal, minBal) VALUES('Dept C', 'Department c does work', 70.00, 5.00);

INSERT INTO tbl_printer (printerName, hostname, manufactuer, monochrome ) VALUES('Printer 1', '172.31.96.221', 'Company', 1);
INSERT INTO tbl_printer (printerName, hostname, manufactuer, monochrome ) VALUES('Printer 2', '172.31.96.222', 'Company', 0);
INSERT INTO tbl_printer (printerName, hostname, manufactuer, monochrome ) VALUES('Printer 3', '172.31.96.223', 'Company', 0);
INSERT INTO tbl_printer (printerName, hostname, manufactuer, monochrome ) VALUES('Printer 4', '172.31.96.224', 'Company', 1);
INSERT INTO tbl_printer (printerName, hostname, manufactuer, monochrome ) VALUES('Printer 5', '172.31.96.225', 'Company', 1);
INSERT INTO tbl_printer (printerName, hostname, manufactuer, monochrome ) VALUES('Printer 6', '172.31.96.226', 'Company', 0);
INSERT INTO tbl_printer (printerName, hostname, manufactuer, monochrome ) VALUES('Printer 7', '172.31.96.227', 'Company', 1);

INSERT INTO tbl_deptPrinter (printerRef, deptRef) VALUES ( 1, 2 );
INSERT INTO tbl_deptPrinter (printerRef, deptRef) VALUES ( 2, 1 );
INSERT INTO tbl_deptPrinter (printerRef, deptRef) VALUES ( 3, 1 );
INSERT INTO tbl_deptPrinter (printerRef, deptRef) VALUES ( 4, 3 );
INSERT INTO tbl_deptPrinter (printerRef, deptRef) VALUES ( 5, 3 );
INSERT INTO tbl_deptPrinter (printerRef, deptRef) VALUES ( 6, 1 );

------Web page flow-------

departmentList,php -> updateDepartment.php -> processUpdate.php


departmentList,php: lists all departments by name and a couple of other attributes in a table. One of the attributes will be a link to
updateDepartment.php where the deptId will be passed through the URL.

updateDepartment.php: will show a form with pre-populated fields showing an individual departments details based on the deptId passed in the URL

processUpdate.php: All values from the form in updateDepartment.php with be posted ($_POST) to processUpdate.php where the vlaues will be updated in the database.

------Problem-------

I want to have a list of printer names and a checkbox next to each name where the user will see a ticked checkbox if there is a record in the tbl_deptprinter table that matches the deptId and pritnerID, which in the tbl_deptprinter would be deptRef & printerRef

I would imagine that it could be done by looping through tbl_printer and fetching each row, with another loop inside that goes through tbl_deptprinter to see if there is a record that matched the deptId & printerId from the row returned from the first loop.

I know there is a lot here but my experience with php means I dont yet have the ability to solve the problem!

The code that I posted on the forum was created for me, which i understand but an unable to modify/extend.

Thanks for your help.

davidj
11-16-2006, 09:26 AM
i will look at this tonight (GMT) if you can wait and will replicate your senario


I will solve this tonight and post resolution here

lux
11-16-2006, 09:28 AM
thanks for your help and no rush i've got pleantly of other stuff to be getting on with, hehe.

if you need any more info please let me know

best regards

davidj
11-16-2006, 09:30 AM
you have posted a SQL script

can you upload your pages also (in ZIP) so i can run this as you see it

lux
11-16-2006, 09:43 AM
where would be the best place to upload them, yousendit.com or somewhere?

davidj
11-16-2006, 09:46 AM
just upload them here in a zip

lux
11-16-2006, 01:51 PM
couldn't upload it here.

Error message said I had exceeded my limit by 3k (the size of the zip file) and i haven't uploaded anything before.

(i've probably overlooked some options or something)


anyway i've uploaded it here:
http://download.yousendit.com/65EC9FEA0DD12CBA

davidj
11-16-2006, 07:40 PM
ok lux

i hope i have understood this correctly

in your test page replace everything but leave your connecting include in (i had to change my version a bit for it to work)

ok here you go

fingers crossed



$sql = "SELECT * FROM tbl_deptprinter";
$deptPrinter =mysql_query($sql);

if (mysql_num_rows($deptPrinter) > 0) {
while ($deppri = mysql_fetch_array($deptPrinter))
{
$d = $deppri['deptRef'];
$print = $deppri['printerRef'];
/*Ive had coded the value of deptId which will be passed via the URL. For this example it is deptId=1 */
if ($d == 1) {
echo $print;
echo "<input type=\"checkbox\" name=\"NA[]\" value=\"".$print."\" CHECKED>";
echo "<br />";
}
}
}
echo "<br />";
/*Loops through tbl_printer and assigns the printerId as the checkbox value. */
$sql = "SELECT * FROM tbl_printer";
$Printer =mysql_query($sql);
if (mysql_num_rows($Printer) > 0) {
while ($print = mysql_fetch_array($Printer))
{
$printerName = $print['printerName'];
$printerId = $print['printerId'];
echo $printerName;
echo "<input type=\"checkbox\" name=\"NA[]\" value=\"".$printerId."\"";
if (!(strcmp($print[4], '0'))){echo "checked";}
echo ">";
echo " $printerId";
echo "<br />";
}
}
echo "<br />";

lux
11-16-2006, 09:00 PM
YOU SIR ARE A LEGEND

haha, i'll now be able to get a good night sleep! haha

thanks again!

davidj
11-16-2006, 09:08 PM
I Try

although not a legend like King Arthur more like borat

domedia
11-17-2006, 01:45 AM
If we had voting on member of the year for this and that (maybe we should?), davidj would clear the table :-D

davidj
11-17-2006, 06:08 AM
aww shucks
:oops:

lux
11-17-2006, 12:44 PM
umm, right

last night it looked like it was returning the right result but ummm, it wasn't what i was after.

what i want to do is display a list of printers from the printer table with checkboxes and for those printers which are associated with a particular department have the checkbox ticked (selected).

To do this the code needs to look in the composite table (tbl_deptprinter) and see if there is a record thats matchs the correct deptId and printerId.

Does that make sense? ( i hope so)

davidj
11-17-2006, 12:57 PM
i will resolve this tonight

lux
11-17-2006, 01:02 PM
thats for your efforts, i really appreciate it,

regards

davidj
11-22-2006, 06:36 AM
ok

test4.php ...


<?php
/*Connect to mysql database*/
include("Connections/connection.php");
$deptref = $_GET['dept'];
$sql_printer = "SELECT * FROM tbl_printer left join tbl_deptprinter on printerRef = printerId";
$query_printer = mysql_query($sql_printer);
$row = mysql_fetch_array($query_printer);

$sql_dept = "SELECT * FROM tbl_dept";
$query_dept = mysql_query($sql_dept );
$row2 = mysql_fetch_array($query_dept);

$sql_deptPrint = "SELECT * FROM tbl_deptprinter where deptRef = '$deptref'";
$query_deptPrint = mysql_query($sql_deptPrint );
$row3 = mysql_fetch_array($query_deptPrint);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="174" border="1">
<tr>
<td width="47">&nbsp;</td>
<td width="111">&nbsp;</td>
</tr>
<?php do { ?>
<tr onclick="document.location.href='test4.php?dept=<?php echo $row2['deptId']; ?>'">
<td colspan="2"><?php echo $row2['deptName']; ?></td>
</tr>
<?php }while ($row2 = mysql_fetch_array($query_dept)); ?>
</table>
<p>&nbsp;</p>
<table width="233" border="1">
<tr>
<td width="47">&nbsp;</td>
<td width="111">&nbsp;</td>
<td width="53">&nbsp;</td>
</tr>

<?php

do {

?>
<tr>
<td>&nbsp;</td>
<td align="center" valign="middle"><?php echo $row['printerName']; ?></td>
<td align="center" valign="middle">

<input type="checkbox" name="<?php echo $row['printerName'] ;?>" value="1" <?php if(!(strcmp($_GET['dept'], $row['printerDept']))){echo "checked";}?>/>

</td>
</tr>
<?php

$count2++ ;

}while ($row = mysql_fetch_array($query_printer));

?>

</table>
<p>&nbsp;</p>

</form>
</body>
</html>



SQL Build ...


# SQL Manager 2005 Lite for MySQL 3.7.6.2
# ---------------------------------------
# Host : localhost
# Port : 3306
# Database : new_db

SET FOREIGN_KEY_CHECKS=0;
DROP DATABASE IF EXISTS `new_db`;
CREATE DATABASE `new_db`
CHARACTER SET 'latin1'
COLLATE 'latin1_swedish_ci';
USE `new_db`;
#
# Structure for the `tbl_dept` table :
#
CREATE TABLE `tbl_dept` (
`deptId` int(11) NOT NULL auto_increment,
`deptName` varchar(100) default NULL,
`description` varchar(255) default NULL,
`deptBal` float default NULL,
`minBal` float default NULL,
PRIMARY KEY (`deptId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Structure for the `tbl_printer` table :
#
CREATE TABLE `tbl_printer` (
`printerId` int(11) NOT NULL auto_increment,
`printerName` varchar(100) default NULL,
`hostname` varchar(100) default NULL,
`manufactuer` varchar(255) default NULL,
`monochrome` tinyint(1) default NULL,
`printerDept` varchar(20) default NULL,
PRIMARY KEY (`printerId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Structure for the `tbl_deptprinter` table :
#
CREATE TABLE `tbl_deptprinter` (
`printerRef` int(11) default NULL,
`deptRef` int(11) default NULL,
KEY `printerRef` (`printerRef`),
KEY `deptRef` (`deptRef`),
CONSTRAINT `tbl_deptprinter_ibfk_1` FOREIGN KEY (`printerRef`) REFERENCES `tbl_printer` (`printerId`),
CONSTRAINT `tbl_deptprinter_ibfk_2` FOREIGN KEY (`deptRef`) REFERENCES `tbl_dept` (`deptId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
#
# Data for the `tbl_dept` table (LIMIT 0,500)
#
INSERT INTO `tbl_dept` (`deptId`, `deptName`, `description`, `deptBal`, `minBal`) VALUES
(1,'Dept A','Department a does a lot of work',100,5),
(2,'Dept B','Department b does a fair amount of work',70,5),
(3,'Dept C','Department c does work',70,5);
COMMIT;
#
# Data for the `tbl_printer` table (LIMIT 0,500)
#
INSERT INTO `tbl_printer` (`printerId`, `printerName`, `hostname`, `manufactuer`, `monochrome`, `printerDept`) VALUES
(1,'Printer 1','172.31.96.221','Company',1,'2'),
(2,'Printer 2','172.31.96.222','Company',0,'1'),
(3,'Printer 3','172.31.96.223','Company',0,'1'),
(4,'Printer 4','172.31.96.224','Company',1,'3'),
(5,'Printer 5','172.31.96.225','Company',1,'3'),
(6,'Printer 6','172.31.96.226','Company',0,'1'),
(7,'Printer 7','172.31.96.227','Company',1,'2');
COMMIT;
#
# Data for the `tbl_deptprinter` table (LIMIT 0,500)
#
INSERT INTO `tbl_deptprinter` (`printerRef`, `deptRef`) VALUES
(1,2),
(2,1),
(3,1),
(4,3),
(5,3),
(6,1),
(7,2);
COMMIT;


NOTE the addition to one of the tables. This extra field is for test purposes although it would be easy to either leave it in or you could do a join in your SQL to link the printer -> deptprinter table

lux
11-22-2006, 07:57 AM
brilliant! you've just made my day a lot better, haha

cheers again

davidj
11-22-2006, 08:03 AM
go through the code with a sharp eye

i started down the $count++ route and moved onto other routes like arrays

There could be redundant code in the script so just rip it out if you think its there for no reason

lux
11-22-2006, 08:26 AM
will do, just changing the name and value attributes to suit my update sql query.

cheers for all the help

davidj
11-22-2006, 08:32 AM
forgot to mention

the html table containing the departments in test4.php ...

the rows are clickable!!!!