I'm working on a little site. My first file is where i can type a name a sex and a category.
(etc.: Steven M Junior )
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Geef u borstnummer</title>
</head>
<p>
<body>
<h3>Geef uw borstnummer in selecteer uw categorie en geslacht</h3>
<form method="post" action="search.php?go" id="searchform">
<input type="text" name="nummer">
<select id="categorie" name="categorie">
<option value = "0"> Selecteer Categorie </option>
<option value = "B"> Benjamin </option>
<option value = "P"> Pupil </option>
<option value = "M"> Miniem </option>
<option value = "K"> Cadet </option>
<option value = "L"> Scholier </option>
<option value = "J"> Junior </option>
<option value = "S"> Senior </option>
<option value = "M"> Master </option>
</select>
<select id="geslacht" name="geslacht">
<option value = "0"> Selecteer geslacht </option>
<option value = "M"> Man </option>
<option value = "V"> Vrouw </option>
</select>
<input type="submit" name="submit" value="Search">
</form>
</body>
</p>
</html>
The second file uses these 3 variables with a $_POST
method, and afterwards searches them in a mysql database.
This file exports more info about this person.
(etc.: Sex , name, category, club, Date of birth , Number) these are all stored in variables.
(etc.: $Name
, $Category
, ...)
<?php
if(isset($_POST['submit']))
{
if(isset($_GET['go']))
{
// if(preg_match("/^[0-9]*$/", $_POST['nummer']))
// {
$nummer_in=$_POST['nummer'];
$categorie_in=$_POST['categorie'];
$geslacht_in=$_POST['geslacht'];
define('DB_NAME', 'atletiek');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
$db=mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD) or die ('I cannot connect to the database because: ' . mysqli_error());
$mydb = mysqli_select_db($db, "atletiek");
$sql="SELECT * FROM `atleten` WHERE `Borstnr` = $nummer_in AND `Categorie` = '$categorie_in' AND `Geslacht` = '$geslacht_in' ";
$result=mysqli_query($db, $sql);
if (!$result)
{
printf("Error: %s\n", mysqli_error($db));
exit();
}
while($row=mysqli_fetch_array($result))
{
$ID =$row['ID'];
$Geslacht=$row['Geslacht'];
$Naam = $row['Naam'];
$Categorie = $row['Categorie'];
$Club = $row['Club'];
$GeboorteJ = $row['Geboortej'];
$Nummer = $row['Borstnr'];
}
// }
}
else
{
echo "Please enter a search query ";
}
}
?>
Now i want to make a third file That prints these values out on the screen. How can i do this?
I've heard about using anchors ( ?name=Steven
) or somthing like that in the url of the file, but i have no idea how to use this and can't find alot of information around.
Can someone help me out?