Tagging Support

PHP Autocomplete supports ability to add choices automatically as the user is typing into the search field known as “tagging”. Tags are the simplest form of data where the id is also the text. This is especially convenient in the tagging use case where the user can quickly enter a number of tags by separating them with token separators.

<?php
$pac_tag = new C_PhpAutocomplete('tags');
$pac_tag -> set_tags(array("red", "green", "blue", "orange", "white", "black", "purple", "cyan", "teal"), array(","," "));
$pac_tag -> display();
?>
<input id="tags" type="hidden" />

The second parameter is the token separators e.g. array(“,”, ” “). In above example, either a space or a comma will separate a string multiple tags. Try typing in the search field below and entering a space or a comma.

Try it yourself:

[php snippet=”7″] 

No related content found.

Tags: