Hi everyone.. sweet ppl, i have a long time, looking for a script which make this: i need to filter, data of one input from the other one input! for example: I write phone numbers (per line) on the first textarea, and on the other, i put phone numbers that i want to remove from the first textarea, and print results of cleaned numbers on the same page.. someone can help me please! sorry for english errors, im hispanic
I dont have any source bro! im looking for a source.. Look, i want remove some numbers from a list of phone numbersm with a php script.. how can i do?
Pretty straightforward, just do something like this: <?php function clean($emails, $filter) { foreach ($emails as $id => $email) { if (in_array($email, $filter)) { unset($emails[$id]); } } return $emails; } var_dump(clean(array('a@example.com', 'b@example.com', 'c@example.com', 'd@example.com', 'e@example.com'), array('a@example.com', 'd@example.com'))); PHP: Result: array(3) { [1]=> string(13) "b@example.com" [2]=> string(13) "c@example.com" [4]=> string(13) "e@example.com" } Code (markup):
Ok look what I'm looking for.. i have a large phone numbers list, so i want remove, some unwanted numbers from there.. So I want make a form with two textarea inputs, where in the first I paste the phone numbers list, and in the seond, I place the numbers which I want to remove from list.. please help me with entire code
People are unlikely to do everything for nothing. All you have to do is call the function clean (the one used in the previous example) with 2 arrays, 1 holding the phone numbers and the other with the numbers to be removed. The data from the text areas can be referenced through $_POST, then should be split (by a space/ comma) to for the arrays. It is only basic PHP (look on w3schools), and everything I have said has examples on the internet.
ok. just use it <style> .want{ width: 200px; height: 500px; } .unwant{ width: 200px; height: 500px; } </style> <form name="Form" method="post"> <textarea name="1" class="want" placeholder="81881858859,81881858869,81881858879,81881858889,81881858899"></textarea> <textarea name="2" class="unwant" placeholder="81881858859"></textarea> <input type="submit" value="submit" /> </form> <?php function clean($emails, $filter) { foreach ($emails as $id => $email) { if (in_array($email, $filter)) { unset($emails[$id]); } } return $emails; } foreach(clean(explode(',',$_POST['1']), explode(',',$_POST['2'])) as $str){echo $str.'<br>';} PHP: