Question: Making Links

http://www.helpme.com/howtomakethislink … ows&id=221
OR
http://www.helpme.com/howtomakethislink … on=contact

Googling Moogling didn’t help
whats the simplest way to make Links like above

explain with a example please.

I want to make these links for this site
How would the code look like for, going from index.php to contact.php

Looking for answers soon!! :D
thanks!

anyone??

not really sure what you are asking…

Is your question how to (with php) display a link?

if so you can use the echo command.

[php]

// can be initialized many ways, but I use
// what you provided for the example
$action = ‘show’ ;
$id = ‘221’;

// echo out the URL with an anchor
echo ‘’;
echo ‘Click Here
’;
[/php]

I don’t get it…

Can you make a link for going from Index.php to Contact.php

with Contact Us being the text linked[/i]

That’s just HTML…

<a href="http://mydomain.com/contact.php"> Contact Us </a>

Am I missing something else?

yes your missing :lol:

How would these links be in the form of http://www.siteid.com/index.php?action=contact (php code)

What exactly is it that you want to know?

Do you want to know how to create a link? Google - first hit.
Do you want to know how to fetch variables from the URL query? Google - first hit.
Do you want to know how to insert variables into a link URL? Basic PHP knowledge.

As you can see, I’m not really under the impression that you’ve actually done a Google search (or if you did, chose horribly wrong search terms), or even put a little bit of effort into figuring out how to do what you want done. I think what you’re trying to achieve is quite basic and could have easily been looked up, but my sincere apologies if I’m wrong :)

[code]<?php
// for example: thispage.php?word=abracadabra

$val = $_GET[‘word’];
echo “the word is: $val”;

?> [/code]

This is something i been looking for I think.
Can you explain how the above work?
also, how does the page id work?

Perhaps you should take a look at Superglobals.

So is your question how do you create the link or how do you process the data (i.e. from the GET method) that you received?

the GET method passes data in the URL. Anything after the question mark (?) is part of the GET method parameters and will become part of the superglobal array of $_GET with the index being the variable name.

Variables in the URL are then separated by the ampersand symbol (&)

so in http://www.helpme.com/howtomakethislink … ows&id=221

the howtomakethislink.php script would be able to access the variables of action and id by using the superglobal of $_GET[‘action’] and $_GET[‘id’] which would contain the values of show and 221 respectively.

Once accessed the script of howtomakethislink.php could then process them as the programmer (presumably you) feels fit to process them.

Indeed you might want to take a look at http://nl2.php.net/variables.predefined (the Superglobals) for more information.

If I totally missed the point, then I am sorry.

Sponsor our Newsletter | Privacy Policy | Terms of Service