Help with some php coding


#1

Hello.
am working on a tagging system and I have an array for the allowed tags what I want is to check if all the words on the string exist on the array if not return an error here is an example of what I want,

// this is the string the user entered from the form input 
$string = "php,css,html5,hello";
// and this is the array of all allowed tags
$array = ("php","css","html5");

now the user entered the world, hello and it’s not in the array so I want to return an error that they entered a word that is not allowed how can I do so, right now a using this code

and thanks very much for the help.


#2

Like your other topic:
Create an array with the tags.
Explode the user input by comma into an array
Make a foreach for the exploded array
If the current foreach tag is present in the tags array using in_array();
If does not exist, exit("WITH AN ERROR");


#3

i was working on my website user profile page but i didn’t get the chance to try the method before but i just tried it and it worked fine for me thanks man for your helps.


closed #4