title: get current URL and previous URL when user pushes button
body: <p>Newby here.</p>
  
  <p>Could someone show me an example of the code needed to do the following:</p>
  
  <p>User pushes a button on my web site (there is no information for him to input, and no form, he just clicks on a button). I have found the following code on another post, but don't know if it is correct (I am also getting a syntax error on it):</p>
  
  <pre><code>&lt;form action="php_file.php"&gt;&lt;input type="submit" value="Click"&gt;&lt;/form&gt; 
  </code></pre>
  
  <p>The author of the above code said "Insert your PHP-Code into the file php_file.php and click the button, your file will be opened. Insert header("Location: html_file.html"); at the end of your php-file to get back to the page."</p>
  
  <p>This click of the button needs to instigate the programming to grab the current URL and previous URL and insert them into the mysql database on my server. I have "PHP_SELF" and "HTTP_REFERER", but still need to get the results into mysql.</p>
  
  <p>I would like to do this using only html, PHP and mysql, if possible.</p>
  
  <p>Thanks to everyone for any help!</p>