Must be a valid University of Huddersfield email address! "); } $search = trim(stripslashes($_POST['search'])); $email = trim(stripslashes($_POST['email'])); //Find instruments searched for: $query = "SELECT * FROM instruments WHERE '$search' IN (instrument, instrument2, instrument3, instrument4, instrument5)"; $result = @mysql_query($query); //Start building the table: $table = "

You searched for $search

"; //Now get the person's name from the people table: while($getresults = mysql_fetch_assoc($result)){ $peoplequery = "SELECT * FROM people WHERE id = {$getresults [id]}"; $peopleresults = @mysql_query($peoplequery); $getpeopleresults = mysql_fetch_assoc($peopleresults); //add the details returned by the database to the table: $table .= " } "; } $table .= "

Name

Email

Course

Grade

Standard

Comments

{$getpeopleresults [first]} {$getpeopleresults [last]}

{$getpeopleresults [email]}

{$getpeopleresults [course]}

{$getresults [grade]}

{$getresults [standard]}

{$getresults [comments]}


"; //echo $table; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "From: Musicians Database"; $to = ($_POST['email']); $subject = "Musicians Database Search"; $body = " $table"; if (mail($to, $subject, $body, $headers)) { header("Location:thanks.html"); exit(); } } mysql_close($s, $u, $p); // close connection ?> test

Search Page



Use the form below to search for a musician:

" onsubmit="return validate_form(this)";>  

Instrument to Search For:

Email Address: (MUST be your Uni Email)