Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8581059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:57:34+00:00 2026-06-11T20:57:34+00:00

I am attempting to dynamically grab a page’s title and URL and echo into

  • 0

I am attempting to dynamically grab a page’s title and URL and echo into HTML. Here’s what I have:

<ul>
    <li><a href="mailto:?Subject=<?php echo $page_title?>&body=<?php echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>" class="email" title="Email">Email</a>
    </li>
</ul>

The URL successfully echos, but I’m not sure if this is the correct way? And I can not figure out how to print the page’s title via <?php echo $page_title?>?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:57:35+00:00Added an answer on June 11, 2026 at 8:57 pm

    There is no global PHP variable which corresponds to the page <title>. Unless you earlier used the $page_title variable to specify the <title>…

    <?php $page_title = "My Page Title"; ?>
    <title><?php echo $page_title ?></title>
    

    …<?php echo $page_title?> wont’ do anything special.

    If you did use the $page_title variable in this way, you might need to encode the data. It should be both URI encoded and HTML encoded – in that order.

    <a href="mailto:?Subject=<?php echo htmlentities(urlencode($page_title)); ?>" class="email" title="Email">Email</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am attempting to dynamically create html which then injects itself as an iframe into
I am attempting to dynamically incorporate an external source of html into a jQuery
I have an image loader that I am attempting to resize dynamically. I would
I am attempting to dynamically create a profile page. Everything works fine except when
I'm attempting to dynamically create a button control for each image I have in
I'm attempting to dynamically add both columns and rows to a TableLayoutPanel. I have
I'm attempting to have a UITableView that I can dynamically add and remove rows
I am attempting to load classes dynamically into a component. I am using a
I'm attempting to call the msgs.loginUsername property, by dynamically grabbing loginUsername from the html
I'm attempting to dynamically use a value in an array within an object. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.