How to get current html page's title using PHP?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TanuLamba15
    New Member
    • Feb 2015
    • 3

    #1

    How to get current html page's title using PHP?

    Hi All,

    I want to get the current page title using PHP.

    I tried "var $subject_title =(document.titl e);" javascript code, but could not get this in PHP code.

    Can anyone help me for this.

    Please let me know if you want more information on this.


    Thanks in advance!
  • Claus Mygind
    Contributor
    • Mar 2008
    • 571

    #2
    Since the "submit" button transmits the controls on a form in the form of an array, why don't you just code an id into the form. Then that can be recovered by the "$_REQUEST" on your php side.

    It almost seems however you are trying to execute php on the client side, which of course cannot be done. It only executes on the server side.

    To use javaScript, you simply do this
    Code:
    var x = document.title;
    You can read more about that here?
    W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

    Comment

    Working...