hallo zusammen
ich habe ein problem mit PHP und javascript. der code sollte alle checkboxes aktivieren (link "Select all") bzw. deaktivieren (link "Unselect all). nur erhalte ich dauernd fehlermedlungen.
weiss jemand warum, bzw, wo ich den fehler habe??
vielen dank für einen vorschlag!!
gruss,
georg
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Delete User</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = true ;
}
function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = false ;
}
</script>
</HEAD>
<body background="../images/cla_background.gif">
<H3><font face='Arial' size='2'>Delete User/s</font></H3>
<HR>
<FORM name='form' action='deleteusr.php' method='post'>
<?php
$link=mysql_connect();
mysql_select_db("eclaro");
$request="SELECT usr FROM user;";
$result=mysql_query($request) or die ("Error=".mysql_error());
$number=mysql_num_rows($result);
echo $number."<font face='Arial' size='2'> User/s</font><P>";
for ($i=0; $i<mysql_num_fields($result); $i++)
echo "<TABLE border='0' width='25%'>";
while ($zeile=mysql_fetch_row($result))
{echo "<TR align='center' font face='Arial' size='2'><TD><INPUT type='checkbox'
name='Kontroll[]' value='$zeile[0]'></TD>";
for ($i=0; $i<mysql_num_fields ($result); $i++)
{echo "<TD align='left'><font face='Arial' size='2'>".$zeile[0]."</font></TD>";};
echo "</TR>";};
echo "</TABLE>";
mysql_free_result($result);
mysql_close($link);
?>
<P>
<INPUT type='submit' value='Delete'>
<INPUT type='reset' value='Reset'>
</FORM>
<HR>
<table border="0" width="30%">
<tr>
<td width="50%"><font face='Arial' size='2'><a href='javascript:checkAll(document.form.Kontroll[])'>Select all</a></font></td>
<td width="50%"><font face='Arial' size='2'><a href='javascript:uncheckAll(document.form.Kontroll[])'>Unselect all</a></font></td>
</tr>
</table>
</HTML>
ich habe ein problem mit PHP und javascript. der code sollte alle checkboxes aktivieren (link "Select all") bzw. deaktivieren (link "Unselect all). nur erhalte ich dauernd fehlermedlungen.
weiss jemand warum, bzw, wo ich den fehler habe??
vielen dank für einen vorschlag!!
gruss,
georg
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Delete User</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = true ;
}
function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = false ;
}
</script>
</HEAD>
<body background="../images/cla_background.gif">
<H3><font face='Arial' size='2'>Delete User/s</font></H3>
<HR>
<FORM name='form' action='deleteusr.php' method='post'>
<?php
$link=mysql_connect();
mysql_select_db("eclaro");
$request="SELECT usr FROM user;";
$result=mysql_query($request) or die ("Error=".mysql_error());
$number=mysql_num_rows($result);
echo $number."<font face='Arial' size='2'> User/s</font><P>";
for ($i=0; $i<mysql_num_fields($result); $i++)
echo "<TABLE border='0' width='25%'>";
while ($zeile=mysql_fetch_row($result))
{echo "<TR align='center' font face='Arial' size='2'><TD><INPUT type='checkbox'
name='Kontroll[]' value='$zeile[0]'></TD>";
for ($i=0; $i<mysql_num_fields ($result); $i++)
{echo "<TD align='left'><font face='Arial' size='2'>".$zeile[0]."</font></TD>";};
echo "</TR>";};
echo "</TABLE>";
mysql_free_result($result);
mysql_close($link);
?>
<P>
<INPUT type='submit' value='Delete'>
<INPUT type='reset' value='Reset'>
</FORM>
<HR>
<table border="0" width="30%">
<tr>
<td width="50%"><font face='Arial' size='2'><a href='javascript:checkAll(document.form.Kontroll[])'>Select all</a></font></td>
<td width="50%"><font face='Arial' size='2'><a href='javascript:uncheckAll(document.form.Kontroll[])'>Unselect all</a></font></td>
</tr>
</table>
</HTML>
Kommentar