Jump to content

Filter data from one input


firstminister

Recommended Posts

LOL sometimes i put for example:

1

6

1

6 to filter the number 6 only, and appears again:

 

1

6

1

6 as filtered..

 

 

And is possble that, i could set in text input, how much numbers i'm setting on the first textarea?

 

for example:

344554

456456

546456

5466

 

(In input under textarea) 4 numbers

 

and, in the results, after filter says: You hace deleted 56 numbers from list.

You can always use count().

<?php
if (isset($_POST['listnumbers'])){
$Newlist = explode(PHP_EOL, trim($_POST['listnumbers']));
$before_count = count($Newlist);
$Searchlist = explode(PHP_EOL, trim($_POST['searchnumbers']));
$Newlist = array_diff($Newlist,$Searchlist);
$after_count = count($Newlist);
$phone_number_list = implode("<br />",$Newlist);
}
echo "Before: $before_count After: $after_count";
?>

Excelent, i have set count as you said! perfect..i'm thankful for your help.. Can i put one little normal text input under the textarea where i put the numbers list, where appears one number like counter per line to count how much number im setting?

 

for example, for each enter, that add +1 in the input.. and thanks for this, you are splendid.

oh and you know, when i set on the listnumbers 2 same numbers, and i set on searchnumbers just one number, obviously the same of listnumbers to filter, it just delete one of two numbers.. i should repeat twice the number on searchnumber to delete it.. how can i do for, just set one time the number and that deletes 2 repeated numbers on list?

If you are talking about AS you put each number in, it would update the count of numbers, no, not with php.  You'd need some Javascript for that.

 

As for duplicates in original main list not being removed, they are everytime I've tested it.  I put in

1
2
1
4

...and then filter out 1, I'm left with

2
4

Can you give me any example of numbers where it hasn't worked?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.