does anyone know how friendster does the thing where you can enter a string of words into a form where you are supposed to type, for example, "favorite bands:". so you type in your favorite bands, seperated by commas and submit the form. when it displays your page of favorite bands, it takes the band names and makes each one into a link that takes you to a page that lists everyone with that band in their favorites.
i don't know how vague i am being, but if you need more of an explanation i could try. basically i'd just like to know how you can take a string of words seperated by commas and make them each into individual variables.
any suggestions? thanks...
question about INSERT / queries
Moderator: General Moderators
check out the example of explode() on the manual page
http://us4.php.net/manual/en/function.explode.php
insert the values of the resulting array into your database..
http://us4.php.net/manual/en/function.explode.php
insert the values of the resulting array into your database..
Code: Select all
"INSERT INTO favorites (fav1,fav2,fav3) VALUES ('{$favsї0]}','{$favsї1]}','{$favsї2]}')"-
microthick
- Forum Regular
- Posts: 543
- Joined: Wed Sep 24, 2003 2:15 pm
- Location: Vancouver, BC
Code: Select all
$somestring = "britney,bsb,nsync";
$bands = explode(",", $somestring);
for ($i = 0; $i < count($bands); $i++) {
echo "<a href="somepage.php?band=".$bands[$i]."">".$bands[$i]."</a>";
}