Jump to content


Photo

SOLVED: Verifying CheckBoxes(Checked or Not)


  • Please log in to reply
1 reply to this topic

#1 Design

Design
  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts
  • LocationThe Computer Chair

Posted 23 October 2006 - 01:19 AM

Okay, here's my code(I've got 2 checkboxes, type1 and type2):
function checkType($type)
{
	if($_REQUEST['type1'] == TRUE AND $_REQUEST['type2'] == FALSE)
	{
		$type = "1";
return $type;
	}
	else if($_REQUEST['type1'] == FALSE and $REQUEST['type2'] == TRUE)
	{
		$type = "2";
return $type;
	}
	else
	{
		$type= "3";
return $type;
	}
	}
1. Is this correct assuming that checked = true and unchecked = false?
2. Would it be possible to make this code simpler by using a switch statement? How?

#2 Design

Design
  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts
  • LocationThe Computer Chair

Posted 23 October 2006 - 02:01 AM

nvm, found out for myself :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users