Hi everyone, one of my friends would like to make an introductory tutorial on how to use their website. She wanted to make it kind of fun by having a ‘character’ be the tutorial guide. She has 5 characters she’d like the computer to randomly assign to new players. And since she doesn’t really know PHP well, she’s come to me. I don’t know PHP well but I know it better than her, so here I am asking for a bit of help. Below is my logic.
- Upon registering, a random number (1-5) is generated and inserted in to the user’s table in the DB.
[code]$guide = rand(1, 5);
mysql_query(“INSERT INTO members (email, pass, pass_extra, user, pname, joindate, ip_address, activecode, guide)
VALUES (’$email’, ‘$pass’, ‘$salt’, ‘$user’, ‘$pname’, NOW(), ‘$ip’, ‘$key’, ‘$guide’)”)
or die ('cannot create a new member ’ . mysql_error());[/code]
- Upon logging in grab the $guide value
$player = mysql_query("SELECT mid, user, pass, pass_extra, guide FROM members WHERE binary user = '$user'");
$player = mysql_fetch_assoc($player);
Now here’s where I’m stumped on what to use. Is it possible to use php for this next step, or is it easier in some other form of code?
- Have a file included called guide.php where there is a list of text to choose from (below). And then somehow display that message.
if($guide == 1){ echo 'Howdy!'; }
if($guide == 2){ echo 'Hello'; }
if($guide == 3){ echo 'Hi'; }
if($guide == 4){ echo 'Bonjour!'; }
if($guide == 5){ echo 'Hola'; }
However this is a tutorial, remember, so there needs to be a link they click on called ‘Next’ which displays different information. Guide 1, step 1: “Hi! Ready to begin?” user hits the next button Guide 1, step 2: “Okay, so click on this button” etc
How would I be able to incorporate that, and have the computer remember which step they were on?