Welcome to Dream.In.Code
Become a PHP Expert!

Join 150,022 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,498 people online right now. Registration is fast and FREE... Join Now!




Can a hyperlink value be put into a $_GET variable?

 
Reply to this topicStart new topic

Can a hyperlink value be put into a $_GET variable?

matt-the-mash
23 Nov, 2006 - 08:03 AM
Post #1

D.I.C Head
**

Joined: 10 Jul, 2006
Posts: 120



Thanked: 1 times
My Contributions
Hi,

I am creating a new navigation system for a website that uses pop-out menue's (which work fine). What i want to do is give the user a choice of contact methods:
phone
email
post

Instead of directing to another page, i wanted to just display the required method in a table/div etc within the current page.

So can i put the hyperlink value for 'telephone' into a the php variable $_GET to then echo the required method which i will store in a variable?

I expect this couold be done with javascript but i know even less of that than PHP!! biggrin.gif

CODE
<ul>
          <li><a href="???" id="c1" name="Telephone" title="By Telephone">By Telephone</a>
          <li><a href="???" id="c2" name="email" title="By Email">By Email</a>
          <li><a href="???" id="c3" name="post" title="By Post">By Post</a>
            
          </li>

User is offlineProfile CardPM
+Quote Post

snoj
RE: Can A Hyperlink Value Be Put Into A $_GET Variable?
23 Nov, 2006 - 08:07 AM
Post #2

Fell off the face of the earth
Group Icon

Joined: 31 Mar, 2003
Posts: 3,325



Thanked: 9 times
Dream Kudos: 750
My Contributions
Yes it's the stuff that follows the ? symbol within the URL. Seperate multiple variableName/value pairs with a & symbol.

Example: http://example.com/somepage.php?variableName=aValue&anotherVariable=anotherValue
User is offlineProfile CardPM
+Quote Post

matt-the-mash
RE: Can A Hyperlink Value Be Put Into A $_GET Variable?
23 Nov, 2006 - 08:20 AM
Post #3

D.I.C Head
**

Joined: 10 Jul, 2006
Posts: 120



Thanked: 1 times
My Contributions
Im not sure i follow.

What i have is a hyperlink called 'telephone', and when i click this link i want the value 'telephone' to be assigned to the $_GET variable. This i can then use in an IF statement to test
CODE
IF $_GET[''] = 'telephone' {
echo "phone number";
}


I can assign the $_GET variable using form values, i just cant get my head around assigning hyperlink selections.
User is offlineProfile CardPM
+Quote Post

snoj
RE: Can A Hyperlink Value Be Put Into A $_GET Variable?
23 Nov, 2006 - 08:28 AM
Post #4

Fell off the face of the earth
Group Icon

Joined: 31 Mar, 2003
Posts: 3,325



Thanked: 9 times
Dream Kudos: 750
My Contributions
I'm not sure what you're not getting. If you use the URL http://example.com/index.php?telly=3202351446 you can access the value of telly by using $_GET['telly'].

More on URI:
http://en.wikipedia.org/wiki/URI_scheme

The syntax of a URI:
<scheme name> : <hierarchical part> [ ? <query> ] [ # <fragment> ]
User is offlineProfile CardPM
+Quote Post

matt-the-mash
RE: Can A Hyperlink Value Be Put Into A $_GET Variable?
23 Nov, 2006 - 09:17 AM
Post #5

D.I.C Head
**

Joined: 10 Jul, 2006
Posts: 120



Thanked: 1 times
My Contributions
Cheers hotsnoj.

That now works fine.
Another lesson learnt!!!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 09:19PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month