Jump to content

php word separation help


cindreta

Recommended Posts

first im sorry for my bad english i'll try to explain as much as i can.

So i have a system build on php/mysql and it adds articles to a database. And now i wanna ad tags for every article, and i wanna do that so that i can for instance say that every tag will be separated by "," or "space" (example: first tag,secon tag...etc). And i need to insert those tags into a databes for that article. Later i need to use thosse tags for auto suggest searching.

SO how do i do that?

 

Thank you

 

Link to comment
https://forums.phpfreaks.com/topic/102306-php-word-separation-help/
Share on other sites

like i said i just need the code that will do the following:

i have a input field named "tags", and when somebody enters multiple tags separated by a comma ","(example: tag1,tag2,tag3), and then submits that...the code will break thosse tags one by one (by that i mean that when the script sees a comma he threats that as one tag and inserts it into a database). Do you get what i mean?

i just need something that will insert the array of those tags separated by a comma into a databes for tags and then later on i need it to search articles by tags, so that the entered tags come out separate.

well on submission of the form you could use:

 

split(' |,',$_POST['tags']);

explode(',', $_POST['tags']);

 

or any other similar function to produce the desired array of values - you can then loop through these to add to the database.

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.