mongoose0031800 Posted August 13, 2011 Share Posted August 13, 2011 Hey all, Why isn't my script outputting any value when I use the following code? $item_count = count($_POST['qty']); die($item_count-1); I've already tested that $_POST['qty'] isn't empty. If I output count($_POST['qty']) then it displays a value. But if I try to subtract a value of 1, no value comes out. I swear I've seen people add/subtract values from a count function...am I wrong about this? Thanks! mongoose Link to comment https://forums.phpfreaks.com/topic/244706-php-count-function/ Share on other sites More sharing options...
jcbones Posted August 13, 2011 Share Posted August 13, 2011 <?php $_POST['qty'][] = 3; $_POST['qty'][]=4; if(!empty($_POST['qty'])) { $item_count = COUNT($_POST['qty']) - 1; } echo $item_count; //should echo 1; ?> Link to comment https://forums.phpfreaks.com/topic/244706-php-count-function/#findComment-1256901 Share on other sites More sharing options...
mongoose0031800 Posted August 13, 2011 Author Share Posted August 13, 2011 Thanks its working now! Link to comment https://forums.phpfreaks.com/topic/244706-php-count-function/#findComment-1256911 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.