# Get back variable - PHP

**URL:** <https://forum.kirupa.com/t/get-back-variable-php/45505>\
**Category:** Uncategorized\
**Created:** [March 15, 2004, 11:44am UTC](https://forum.kirupa.com/t/get-back-variable-php/45505 "2004-03-15T11:44:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neo\_Geo](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@Neo\_Geo](https://forum.kirupa.com/u/Neo_Geo)\
**Post date:** [March 15, 2004, 11:44am UTC](https://forum.kirupa.com/t/get-back-variable-php/45505/1 "2004-03-15T11:44:26Z")

</div>

this is the code in firstpage.php

```php

$test = "hello";
echo "<a href = 'secondpage.php?var = $test'>nextpage</a>";

```

how can i get back the variable $test’s value in secondpage.php

---

<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:** [March 15, 2004, 3:55pm UTC](https://forum.kirupa.com/t/get-back-variable-php/45505/2 "2004-03-15T15:55:34Z")

</div>

```php

//firstpage.php
$test = "hello";
$test = urlencode($test); //make sure variable can be sent thru $_GET
echo "<a href='secondpage.php?var=$test'>nextpage</a>";
//secondpage.php
$test = $_GET['test'];

```
