Answers for "header title php"

PHP
3

php header

<html>
<?php
/* This will give an error. Note the output
 * above, which is before the header() call */
header('Location: http://www.example.com/');
exit;
?>
Posted by: Guest on April-16-2020
1

php title

function set_page_title(){
  global $page_title; 
  /*
    you should make the variable global so the function can access it and set it to the page title
    otherwise you will get an error.
  */
  if(isset($page_title)){ /*Check if my code has that variable*/
    echo $page_title;
  }
  else{
    echo "Page Title";
  }
}
/*
  HTML Layout
  <!DOCTYPE html>
  <head>
    <title><?php set_page_title() ?></title>
  </head>
  ...
*/
Posted by: Guest on June-14-2021

Browse Popular Code Answers by Language