Page 1 of 1

multiple checkboxes issue for IE

Posted: Sun Aug 27, 2006 2:35 am
by deke
hello everyone, i'm new to php and was having a problem with enabling multiple checkboxes. My code works just fine on firefox but doesnt do a thing on IE. what could be the problem? thanks.

Code: Select all

<?php
 /*Deactivate and Activate*/
  if(isset($_POST['Activate']))
 {
    if(!empty($_POST['checkbox']))
         {
                foreach($_POST['checkbox'] as $tempID)
                 {
                        $sql = "UPDATE category set CatStatus = \"Active\" where CatID=\"$tempID\"";
                         $result = mysql_query($sql, $conn) or die(mysql_error());
                 }
    }
       
 }
 elseif (isset($_POST['Deactivate']))
 {
     if(!empty($_POST['checkbox']))
         {
                foreach($_POST['checkbox'] as $tempID)
                 {
                        $sql = "UPDATE category set CatStatus = \"Inactive\" where CatID=\"$tempID\"";
                         $result = mysql_query($sql, $conn) or die(mysql_error());
                 }
    }
       
 }
?>

Posted: Sun Aug 27, 2006 3:30 am
by RobertGonzalez
Try echoing out your queries before running them to see what the server is seeing. I can't imagine the browser would do anything with this, but just to be safe, clear your broswer cache, cookies and history. Then run the page again. Also, try running the script in Opera and see if the results are different.

sorry

Posted: Sun Aug 27, 2006 11:17 am
by deke
apparently i wasnt able to include the code i used to display the items... anyway, thanks and here is the code

Code: Select all

<?php
  /*Check and Uncheck All*/
 
  if(isset($_POST['CheckAll']))
  {
  	if(checkIfNull($value))
	{ 
		echo "<input type=\"hidden\" name=\"previousValue\" value=\"$value\">";
		if ( ( $status == "Active") or ( $status == "Inactive" ) )
		{
			$sql = "Select * from category where CatName like \"%$value%\" AND CatStatus = \"$status\" order by CatName";
			echo "<input type=\"hidden\" name=\"Status\" value=\"$status\">";
		}
		else
		{
			$sql = "Select * from category where CatName like \"%$value%\" order by CatName";
			echo "<input type=\"hidden\" name=\"Status\" value=\"$status\">";
		}
		$result = mysql_query($sql, $conn) or die (mysql_error());
		
		while( $newArray = mysql_fetch_array($result))
		{
			$CategoryID = $newArray['CatID'];
			$CategoryName = $newArray['CatName'];
			$CategoryStatus = $newArray['CatStatus'];	 
			echo "<tr class=\"RowMouseOver\">
			<td class=\"TextTable\"><label>
			<input type=\"checkbox\" name=\"checkbox[]\" value=\"$CategoryID\". 
			  \"checked=\"checked\"/>
			</label></td>
			<td class=\"TextTableLeftAlign\">$CategoryName</td>
			<td class=\"TextTableLeftAlign\">$CategoryStatus</td>
			<td class=\"TextTableRightAlign\"><a
			href=\"categoryedit.php?CategoryName=$CategoryName&CategoryID=$CategoryID\" 
			class=\"LinkStyle1\">Edit</a></td>
			</tr>";
		}
	}
  }
  elseif (isset($_POST['ClearAll']))
  {  
		echo "<input type=\"hidden\" name=\"previousValue\" value=\"$value\">";
		if ( ( $status == "Active") or ( $status == "Inactive" ) )
		{
			$sql = "Select * from category where CatName like \"%$value%\" AND CatStatus = \"$status\" order by CatName";
			echo "<input type=\"hidden\" name=\"Status\" value=\"$status\">";
		}
		else
		{
			$sql = "Select * from category where CatName like \"%$value%\" order by CatName";
			echo "<input type=\"hidden\" name=\"Status\" value=\"$status\">";
		}
		$result = mysql_query($sql, $conn) or die (mysql_error());
		
		while( $newArray = mysql_fetch_array($result))
		{
			$CategoryID = $newArray['CatID'];
			$CategoryName = $newArray['CatName'];
			$CategoryStatus = $newArray['CatStatus'];	 
			echo "<tr class=\"RowMouseOver\">
			<td class=\"TextTable\"><label>
			<input type=\"checkbox\" name=\"checkbox[]\" value=\"$CategoryID\".
			</label></td>
			<td class=\"TextTableLeftAlign\">$CategoryName</td>
			<td class=\"TextTableLeftAlign\">$CategoryStatus</td>
			<td class=\"TextTableRightAlign\"><a
			href=\"categoryedit.php?CategoryName=$CategoryName&CategoryID=$CategoryID\" 
			class=\"LinkStyle1\">Edit</a></td>
			</tr>";
		}
	}
  }
?>
thanks again