How do I set variable and go to webpage in one click? [Solved/Closed]

Report
Posts
1004
Registration date
Saturday January 17, 2015
Status
Moderator
Last seen
November 27, 2020
-
Posts
1004
Registration date
Saturday January 17, 2015
Status
Moderator
Last seen
November 27, 2020
-
Hi all,

Im trying to improve a web site and the best way I can think to describe this problem is quite long winded and obtuse. I hope someone can see what I want and recommend a solution.

Firstly Im new to php and will need telling in easy idiots guide fashion.

Ok the problem ...

I want users to be able to customize a storybook (which is meant for a select few). I want them to be able to click on a "link" and the following pages change with an addition of their name which they have selected from a list. A crude example would be like this ...

Page 1
Hello. this story is about [John] [Doreen] [Lewis] [Toni]

The bits in bold are 4 "links". Now suppose the user selects "Toni"

Now page 2 ...
One day Toni was walking down the street and met [Sally] [Dave] [Abdul] [Doreen]...

The text in italics has been selected from the "link" in page 1

Does anyone know how I can do this please?

oh ... and Im not going to tell you the rest of the story


EDIT ... ok - I'll tell you a different story about a bear if I get a resopnce :^)

1 reply

Posts
1004
Registration date
Saturday January 17, 2015
Status
Moderator
Last seen
November 27, 2020
118
I think I did it ...

The shortcut (in this case the first name on page 1) is given the following link:
<a href="name1.php?location=chosenname" title="namechoise1">namechoise1</a>

The other names (from the list you choose from) get a similar link but chosenname and namechoise are different.

All subsequent pages where you want the name to be gets this code ...
<?php echo htmlspecialchars($_GET['namechoise1']); ?>

I believe the htmlspecialchars adds some security against hackers injecting their own code, but in this case I dont see how this can happen.

Anyway, thats how I think it works.

Hope its all clear.

I really appreciate thank you messages as a payment for solving issues :o)
1
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2942 users have said thank you to us this month

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!