title: How to create a submit button and link to open in new page rather than printing result on page?
body: <p>I am using this code to query my database which has 10 links. Currently this code prints the link out on the top of my page (the page which queries this). I want a "lucky dip" button to feature on this page, and then when you click the button it should open a random link inside of my database, rather than appearing in text format at the top of my page.</p>
  
  <p>Thanks for any help in advance</p>
  
  <pre><code>}else{
          //query db here
          $row = clean_string($db_server, $_POST["ROWname"]) ;
          //create sqli query
          $query = "SELECT link FROM landmark ORDER BY RAND() LIMIT 1";
          //query db
          mysqli_select_db($db_server, $db_database);
          $result = mysqli_query($db_server, $query);
          if (!$result) die("Database access failed: " . mysqli_error($db_server));
  
          //print out any rows
          $message = "";
  
          while($row = mysqli_fetch_array($result)){
              $str_result .= $row['link'] . " "; 
          }
          mysqli_free_result($result);
  
          echo $message . $str_result;
      }
  </code></pre>