Find a Match Page

Screen Shot 2015-04-20 at 09.40.51

The find a match page is a way in which users can search for their perfect partner. The page gives the user different options such as hair colour etc so they can narrow down their search to what they are specifically looking for. The information is within a form which allows the user to select the options we have given them to narrow their search.

</pre>
<p style="text-align: center;">
<div class="container">
<div class="jumbotron">
<form name="search" method="post" action="match.php">
<p>Hair colour:
<select name="hair">
<option value="">Select...</option>
<option value="Brown">Brown</option>
<option value="Ginger">Ginger</option>
<option value="Blonde">Blonde</option>
<option value="Black">Black</option>
</select></p>
<p>Male or Female?
<select name="gender">
<option value="">Select...</option>
<option value="Male">Male</option>
<option value="Female">Female</option></select></p><br>
<p>Age:
<select name="age">
<option value="">Select...</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option></select></p><br>

After this form this php code is used to return the data and if another user has the details the user are looking for they will appear within the match box.

</pre>
<p style="text-align: center;">
<input type="submit" name="search" value="search" style="font-size:20px" a href="index2.php" />
<?php
if(isset($_POST["search"])){

if(!empty($_POST["hair"]) && !empty($_POST["gender"]) && !empty($_POST["age"])) {
$hair = $_POST["hair"];
$gender = $_POST["gender"];
$age = $_POST["age"];

$query = "SELECT * FROM users WHERE hair='{$hair}' AND gender='{$gender}' AND age='{$age}'";
$result = mysqli_query($connection, $query);
while($row = mysqli_fetch_array($result)){
echo "<br> ".$row["firstname"]." ". $row["lastname"]."<br>";
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s