title: How to store page url to mysql database
body: <p>I know this may sound novice to some of the members of this board. I'm attempting to create a 'bookmarking' feature. Is there a way to store page urls to mysql through php? For example, the browser has a save button and when pressed the url a person is viewing is stored in mysql. </p>
  
  <p>I've attempted to do this and its gone very horrible to say the least. I would greatly appreciate any feedback.</p>
  
  <pre><code>   &lt;html&gt;
     &lt;body&gt;
     &lt;form action="&lt;?php echo $_SERVER['SCRIPT_NAME'] ?&gt;" method="post"&gt;
     &lt;input type="submit" value="Save" /&gt;
     &lt;/form&gt;
     &lt;/body&gt;
     &lt;/html&gt;
  
     &lt;?php
     $url = $_GET['url'];
  
     $dbc = mysqli_connect('xxxx', 'xxxx', 'xxxx', 'xxxx')
  
    or die('Error connecting to MySQL server'); 
  
    $query = "INSERT INTO xxxx (url)".
  
    "VALUES('$url')"; 
  
    $result = mysqli_query($dbc, $query)
  
   or die('Error.');
   mysqli_close($dbc);
   ?&gt;
  </code></pre>