title: how to jump to bottom of web page
body: <p>I have an html / php page with a Require statement which includes another page which includes a form. On completion of the form I use an Echo statement to display the result of the form submission to the user. That all works but I want the page to position itself at the bottom so that the user can see the message.</p>
  
  <p>I've tried specifying a location (bottomOfPage) and using it in the header command, but I can't get it to work. </p>
  
  <p>Can you help me out?</p>
  
  <p>Mohammad, I tried incorporating your solution as follows, but it still does not scroll to botttom:</p>
  
  
          QUICK FORM</p>
  
          
              
              <br>
              
              <br>
              
              <br>
              
              <br><br>
              
  
          
  
      
  
  <pre><code>&lt;?php
  
  if(isset($_GET['send'])) //check the submit button was pressed
  </code></pre>
  
  <p>//get variables from POST array. Remember we specified POST method</p>
  
  <pre><code>    $fn = $_GET['firstname'];
      $ln = $_GET['lastname'];
      $em = $_GET['emailadd'];
      $pn = $_GET['phonenum'];
  
      $message = $fn . "\r\n" . $ln . "\r\n";
      $message .= $em . "\r\n" . $pn;
  
      $to = "trevor.reeves@webthemes.com.au";
      $subject = "webThemes Contact";
  
      //set up headers
      $headers = 'From: trevor.reeves@webthemes.com.au' . "\r\n" .
          'Reply-To: trevor.reeves@webthemes.com.au' . "\r\n" .
          'X-Mailer: PHP/' . phpversion ();
  
      //send the email and save the result
      $result = mail ( $to, $subject, $message, $headers );
  
      //was it sent?
      if ($result) {
          echo "&lt;p&gt;Thank you for sending the message&lt;/p&gt;";
          echo "&lt;script&gt;\n";
          $str = "window scrollTo ( 0, document . body . scrollHeight );";
          echo $str;
          echo "\n&lt;/script&gt;";
  
      } else {
          echo "&lt;p&gt;Sorry. An error has occurred. Please email trevor.reeves@webthemes.com.au&lt;/p&gt;";
      }
  </code></pre>
  
  <p>That's not the problem as the PHP script does send an email and display a message. The issue is that the scroll doesn't work:</p>
  
  <pre><code>echo "&lt;script&gt;\n";
  $str = "window scrollTo ( 0, document . body . scrollHeight );";
  echo $str;
  </code></pre>