# How to make a link by PHP

**URL:** <https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270>\
**Category:** Uncategorized\
**Created:** [July 31, 2003, 6:27pm UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270 "2003-07-31T18:27:57Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![OKtrust](https://avatars.discourse-cdn.com/v4/letter/o/c77e96/32.png) [@OKtrust](https://forum.kirupa.com/u/OKtrust)\
**Post date:** [July 31, 2003, 6:27pm UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/1 "2003-07-31T18:27:57Z")

</div>

hi guys,  
I really don’t know and understand how they can create a link like: index.php?link=hoepage or link=contact to go to a new page ? and when they do it, what is the advantage of this PHP link compare to html link ?

thanks all

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2003, 6:59pm UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/2 "2003-07-31T18:59:26Z")

</div>

That is a post variable and not a php link. You can make one page called say index.php that is blank but except for some PHP code in there that uses switch/case statements to check the value of the post variable and then include a file. This is cool because it makes your site smaller. What I do is use include tags for this but I put my header above the switch/case statement and my footer below it so I don’t have to maintain the extra code and can just change it in 1 place.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 31, 2003, 7:16pm UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/3 "2003-07-31T19:16:32Z")

</div>

Here is a link to a tutorial regarding it:  
[http://robouk.mchost.com/tuts/tutorial.php?tutorial=variables](http://robouk.mchost.com/tuts/tutorial.php?tutorial=variables)

And basically, it enables you to reduce the size of your website as DP said. You could even have it so that your website consists of only one PHP page and depending on the query string (e.g. the “?page=home” of [http://www.yourwebsite.com/index.php?page=home](http://www.yourwebsite.com/index.php?page=home)) you could have it include/read/require text or images or both from different files and display them in a certain area of the page.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 1, 2003, 3:45am UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/4 "2003-08-01T03:45:05Z")

</div>

ah I see, it’s very usefull, thanks all for your helping

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 1, 2003, 7:35am UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/5 "2003-08-01T07:35:30Z")

</div>

Any time :).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 1, 2003, 7:52am UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/6 "2003-08-01T07:52:21Z")

</div>

> \*Originally posted by DigitalPimp \*  
> \*\*That is a post variable and not a php link. \*\*  
> That’s a GET variable 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 1, 2003, 8:29am UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/7 "2003-08-01T08:29:12Z")

</div>

Actually, it can be either. A post is more secure because the query string is passed but not included in the URL unlike a GET which does show the query string in the URL. 😉

Just remember ahmed :p: here.

hehe jk

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 1, 2003, 5:17pm UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/8 "2003-08-01T17:17:13Z")

</div>

when saying

> Actually, it can be either. A post is more secure because the query string is passed but not included in the URL unlike a GET which does show the query string in the URL.

you’re contradicting yourself, the query string is included in the url, so how can it be a post var?.. who cares anyway, both work 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 1, 2003, 5:23pm UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/9 "2003-08-01T17:23:56Z")

</div>

No I’m not. In a post the query string is passed to the next page but you can’t see it… In a get the same data is passed but it appears in the URL.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 1, 2003, 5:25pm UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/10 "2003-08-01T17:25:31Z")

</div>

I guess get var when a user submit a value and the URl will bring this var to new page

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 2, 2003, 4:47pm UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/11 "2003-08-02T16:47:44Z")

</div>

@ digi:  
indeed, and the example was

> index.php?link=hoepage  
> , so i guess you can see it…so it couldn’t be post… as i said, both work, so who cares…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 23, 2003, 6:24pm UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/12 "2003-08-23T18:24:21Z")

</div>

hi all again,  
now I can do it easily, but I wonder if I correct this code:

```auto

else if ($vietxuan == "partners") {
echo ("partners");
if ($page == "1") {
include ("partners.php"); 
}
else if ($page == "2") {
include ("partners2.php"); 
}
else if ($page == "3") {
include ("partners3.php");
}
else if ($page == "4") {
include ("partners4.php"); 
} 

```

and this is result: [http://www.vietxuanltd.com/index.php?vietxuan=partners&page=1](http://www.vietxuanltd.com/index.php?vietxuan=partners&page=1)

I found some address they use ; or :: instead of & , please tell me when will we need to use those characters , and what different from each other ?  
thanks guys for your time to read this.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 23, 2003, 10:33pm UTC](https://forum.kirupa.com/t/how-to-make-a-link-by-php/27270/13 "2003-08-23T22:33:18Z")

</div>

replace

```php
if ($page == "1") {
include ("partners.php"); 
}
else if ($page == "2") {
include ("partners2.php"); 
}
else if ($page == "3") {
include ("partners3.php");
}
else if ($page == "4") {
include ("partners4.php"); 
}  

```

with

```php

include ("partners".$page.".php"); 

```

…
