multiple checkboxes issue for IE

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
deke
Forum Newbie
Posts: 5
Joined: Wed Aug 23, 2006 12:59 am

multiple checkboxes issue for IE

Post 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());
                 }
    }
       
 }
?>
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
deke
Forum Newbie
Posts: 5
Joined: Wed Aug 23, 2006 12:59 am

sorry

Post 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
Post Reply