checkbox type...calculation

  • nrsh_ram
  • Novice
  • Novice
  • nrsh_ram
  • Posts: 30
  • Loc: malaysia

Post 3+ Months Ago

hi to all....
i really need help....

in my system have function where a mentor can tick the mentee`s attendance..

for this..im using "checkbox"...so it will generate for each mentee name
so, i want wen i mark the checkbox,the system will calculate how many names i marked...

how to do it?


<input name="mentee_list[]" type="checkbox" value="1" multiple="multiple" option><?php echo $row["mentee"]; ?><br /></option>
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

after they submit or before?

You can use a count on the request in PHP.

PHP Code: [ Select ]
<?php
$names_count = (isset($_REQUEST['mentee_list']) && is_array($_REQUEST['mentee_list'])) ? count($_REQUEST['mentee_list']) : 0;
?>
  1. <?php
  2. $names_count = (isset($_REQUEST['mentee_list']) && is_array($_REQUEST['mentee_list'])) ? count($_REQUEST['mentee_list']) : 0;
  3. ?>
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8416
  • Loc: USA

Post 3+ Months Ago

I suggest you use $_POST.

But like PolishHurricane said, count(); is probably the function you are looking here.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 98 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.