Checkbox error check.

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Mon Dec 01, 2003 11:55 pm

Please check this first

Code: Select all

$dos = $_POST['dos'];
$dontss = $_POST['donts'];

$i = 0;
for ($i=0;$i<count($dos);$i++) {
  if ($dos[$i] == $donts[$i]) {
    echo ("You cant check same things");
  } else {
    //do your code here
  }
}

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Wed Dec 03, 2003 3:13 am

$dontss = $_POST['donts'];

Code: Select all

$dos = $_POST['dos']; 
$donts = $_POST['donts'];

$i = 0;
for ($i=0;$i<count($dos);$i++) {
  if ($dos[$i] == $donts[$i]) {
    echo ("You cant check same things");
  } else {
    //do your code here
  }
}

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Thu Dec 04, 2003 3:33 am

YOu can always use javascript...

Code: Select all

if (document.formname.elements['dos[]'][1].value ==document.formname.elements['donts[]'][1].value) {
 alert("You can't select both values");
}

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest