title: Get Variable from String Parameter MySQL PHP
body: <p>I am having some trouble implementing a RecordResults for a specified event id. It needs to be able to do - the event entry listed at the bottom of the page should include a
  hyperlink that will take the administrator to a new web form for recording results for that event. The
  EventID is passed via a query string parameter, e.g. RecordResults.php?EventID=4.</p>
  
  <p>At the current time I have this code to show:</p>
  
  <p>Records Data into Database</p>
  
  <pre><code>   &lt;?php
  mysql_connect("localhost", "root", "") or die(mysql_error()); 
  
  mysql_select_db("clubresults") or die(mysql_error());
  
  if (isset($_POST['submit'])) {    
  $EventDate = date('D-m-y', $EventDate);
  $sql="INSERT INTO events (EventName, EventDate, Location)
  VALUES
  ('".$_POST['EventName']."', '".$EventDate."', '".$_POST['EventLocation']."')";
  
  $add_event = mysql_query($sql);
  
  echo "Successfully Added 1 Event";
  }
  ?&gt;
  </code></pre>
  
  <p>HTML Form + Generate Table from MySQL Database -</p>
  
  <pre><code>&lt;h2&gt; Add Event To Database &lt;/h2&gt;
  &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="post"&gt;
  Event Name: &lt;input type="text" name="EventName" /&gt;&lt;br&gt;
  Event Date: &lt;input type="text" name="EventDate" /&gt;&lt;br&gt;
  Event Location: &lt;input type="text" name="EventLocation" /&gt;&lt;br&gt;
  &lt;input type="submit" name="submit" value="Add Event" /&gt;
  &lt;/form&gt;
  
  &lt;?php
  
  $query = "SELECT * FROM events";
  $result = mysql_query($query) or die ('Error in Query');
  
  echo '&lt;table width=100% border=1&gt;';
  
  echo '&lt;tr&gt;&lt;td&gt;&lt;b&gt;Event ID&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Event Name&lt;/td&gt;&lt;td&gt;&lt;b&gt;Event Date&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Event Location&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt; Record Results&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;';
  
  while ($row=mysql_fetch_row($result))
  
  {
  
  echo '&lt;tr&gt;';
  
  echo '&lt;td&gt;'.$row[0].'&lt;/td&gt;';
  
  echo '&lt;td&gt;'.$row[1].'&lt;/td&gt;';
  
  echo '&lt;td&gt;'.$row[2].'&lt;/td&gt;';
  
  echo '&lt;td&gt;'.$row[3].'&lt;/td&gt;';
  
  
  echo '&lt;/tr&gt;';
  
  }
  
  echo '&lt;/table&gt;';
  
  mysql_free_result($result);
  
  
  
  ?&gt;
  </code></pre>
  
  <p>I have also been working on this however am not sure how to use this to make a add results hyperlink for each row in the table which passes the URL String.</p>
  
  <pre><code>    // Get id from URL
  $id = mysql_real_escape_string( $_GET['EventID'] );
  
  // If id is number
  if( (int)$id== $id &amp;&amp; (int)$id&gt; 0 ) {
  
       // Get record from database
       $sql = 'SELECT * FROM Evernts WHERE EventID=' . $id;
       $result = mysql_query( $sql, $link );    
       $row = mysql_fetch_array( $result );
  
       // Show record with HTML here - Need to show it in the table!
       print_r( $row );
  
  } else {
  
     echo "Record not found";
  }
  </code></pre>
  
  <p>Any help would be appreciated!</p>
  
  <p>Thanks :D</p>