Hey,
Here's my Tag's script, i only give my own code, so you will need to edit HTML part if needed.
PHP:
[PHP]
$my_id = $_SESSION['user']['id'];
$fetch_tags = mysql_query("SELECT tag,id FROM user_tags WHERE user_id = '".$my_id."' LIMIT 20") or die(mysql_error());
$tags_num = mysql_num_rows($fetch_tags);
$randomq[] = "What is your favourite food?";
$randomq[] = "Who is your favourite actor?";
$randomq[] = "What kind of music do you like?";
$randomq[] = "What is your favourite sport?";
$randomq[] = "Who is your favourite actress?";
$randomq[] = "What is your favourite colour?";
$randomq[] = "What is your favourite band?";
$randomq[] = "What is your favourite TV show?";
$randomq[] = "Which football team do you support?";
$randomq[] = "What is your favourite football team?";
$randomq[] = "Your favourite cartoon?";
$randomq[] = "What is your favourite video game?";
$randomq[] = "What's your favourite pastime?";
$randomq[] = "What kind of mood are you in right now?";
$randomq[] = "What is your favourite movie?";
$randomq[] = "What is your favourite time of year?";
srand ((double) microtime() * 1000000);
$chosen = rand(0,count($randomq)-1);
$tag_question = $randomq[$chosen];
$do = $_GET['do'];
if($do != "") {
mysql_query("DELETE FROM user_tags WHERE id = '".$do."'");
Redirect("me");
}
if (isset($_POST['newtag']))
{
$user_id = $_SESSION['user']['id'];
$tag = htmlspecialchars(addslashes($_POST[newtag]));
if (strlen($user_id) < 1 || strlen($tag) < 1)
{
Redirect("me");
}
else
{
mysql_query("INSERT INTO user_tags (user_id ,tag) VALUES ('" . $user_id . "','" . $tag . "')");
Redirect("me");
}
}
------------------------------------------------- HTML PART -----------------------------------------------------------
PHP:
<div class="content-box-radio">
<div class="habblet-container ">
<ul class="box-tabs">
<li id="tab-3-2" class="selected"><a href="#">My Tags</a><span class="tab-spacer"></span></li>
</ul>
<br />
<a href="me" class="tab-ajax"></a>
</div>
<div id="tab-3-2-content" >
<div id="my-tag-info" class="habblet-content-info">
<?php if($tags_num > 19){ echo "Max limit tag.delete one of your tag and then add."; } elseif($tags_num == 0){ echo "You dont have tag. Answere the question or make ur own."; } elseif($tags_num < 20){ echo "u dident use all of ur tags. Add more!"; } ?>
</div>
<div class="box-content">
<div class="habblet" id="my-tags-list">
<?php if($tags_num > 0){
echo "<ul class=\"tag-list make-clickable\"> ";
while($row = mysql_fetch_assoc($fetch_tags)){
echo " <li><a href=\"tags?tag=".strtolower($row['tag'])."\" class=\"tag\" style=\"font-size:10px\">".strtolower($row['tag'])."</a>
<a href='?do=".$row['id']."' title=\"delete tag\"><img src='app/tpl/skins/Mango/images/tags.gif' /></a></li>";
}
echo "</ul>";
} ?>
<?php if($tags_num < 20){ ?>
<form method="post">
<div class="add-tag-form clearfix">
<input type="image" class="tagme" src="YOURTAGIMG to validate">
<input type="text" name="newtag" id="add-tag-input" maxlength="20" style="float: left"/>
<em class="tag-question"><?php echo $tag_question; ?></em>
</div>
<div style="clear: both"></div>
</form>
<?php } ?>
</div>
</div>
<script type="text/javascript">
document.observe("dom:loaded", function() {
TagHelper.setTexts({
tagLimitText: "you have reached your tag limit - delete 1 if you want to add new one.",
invalidTagText: "Invalid tag",
buttonText: "OK"
});
TagHelper.init('21063711');
});
</script>
</div>
-------------------------------------- SCNSHOT ------------------------------------------
--------------------------------------- C R E D I T S --------------------------------------------
Extreme (me)