# Can i capture the title of a page and use it in a variable

**URL:** <https://forum.kirupa.com/t/can-i-capture-the-title-of-a-page-and-use-it-in-a-variable/258496>\
**Category:** Uncategorized\
**Created:** [April 24, 2008, 3:27pm UTC](https://forum.kirupa.com/t/can-i-capture-the-title-of-a-page-and-use-it-in-a-variable/258496 "2008-04-24T15:27:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![koolkrasher](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@koolkrasher](https://forum.kirupa.com/u/koolkrasher)\
**Post date:** [April 24, 2008, 3:27pm UTC](https://forum.kirupa.com/t/can-i-capture-the-title-of-a-page-and-use-it-in-a-variable/258496/1 "2008-04-24T15:27:40Z")

</div>

is it possible to capture the title of a page using php or javascript?

Im making a link to this page link and i want to be able to put it on a lot of pages without having to make the links for each page.

I figured out how to capture the page url but now i need to capture the page title for my link text.

this is the php i used to get the current page url

```php

<?php
  $domain = $_SERVER['HTTP_HOST'];
  $path = $_SERVER['SCRIPT_NAME'];
  $queryString = $_SERVER['QUERY_STRING'];
  $currenturl = "http://" . $domain . $_SERVER['REQUEST_URI'];
?>

```

Then i printed it out into a text area an dthe link wokrs fine its the “text” of the link im having a problem with

```auto

  <textarea readonly="true" cols="35" rows="35" wrap="soft">
 <?php print "<a href=\"".$currenturl."\"".">"."text"."</a>"; ?>
  </textarea>

```

any ideas?
