Forum Moderators: coopster
I would like to implement something so that I, and the other users can see what skin is being used by everyone else. Hopefully, it would look something like this:
Comment By Programmers (Using the red skin)
" c o m m e n t "
I have just sat and wrote my first ever if statement, and it works. However, it never occoured to me that I wrote it to display my own skin. How can I pick up, and display what skins others are using?
Here's what I just wrote, incase it comes in handy:
<?php
$skin = $_COOKIE['myskin'];
if ($skin == "1") {
echo "Using the red skin";
} else if ($skin == "2") {
echo "Using the blue skin";
} else if ($skin == "3") {
echo "Using the purple skin";
} else {
echo "Using the red skin";
}
?>
Any help would be greatly appreciated.
Regards,
Tom.
//user submits form already
$user = $_SESSION['user']; //Are you using sessions for this?
$text = $_POST['text'];
if(isset($_COOKIE['myskin'])) {
$skin = ($_COOKIE['myskin']-1);
$skin_colors = array [us2.php.net]("red","blue","purple");
$skin = $skin_colors[$skin];
}
else { $skin = "red"; }
//Insert info to DB, using above info
I used an array just to show you another way. Good luck ;)