#!/usr/bin/perl

use CGI qw(:standard);
print header();

print "<html>";
print "<body bgcolor = \"eeccee\" text = \"black\">";
print "<center><h1><u>Search Result";
print "</center></h1></u>";
print "<br><br><br>";

$ipsearchEmail = param('searchEmail');

print "Email search for : $ipsearchEmail <p>";


dbmopen %paricipant,"data/dbparicipant",0666;

	@keys=keys %paricipant;
	$noOfKeys=$#keys+1;      # last index + 1

	
	print "<table border = 1 cellpadding = 2>";
	print "<tr>";
	print "<th>Email OF PARTICANT (Parameter Name) <th> Values(Parameter Value(s))";

 	foreach $email(keys %paricipant) 
 	{

	    if ($ipsearchEmail =~ $email) 
	    {
	 	$value = $paricipant{$email};
	 	@field = split(/&/,$value);
 	
 	 	print "<tr><td> $email <td>";
		print"<ul>";

 		foreach $field (@field) {
 			#print "Field --> $field";print "<br>";
    			($name, $value) = split(/=/, $field);
    			
    			print "<li>$name = $value";
    			#print "NAME VALUE PAIRS --> $name = $value. "; print"<BR>";
    		
    		}
    		print"</ul>";
    		#exit;
    	   }
    	   else 
    	   {
    	     #exit;
    	     print "result not found.. Check the email address";
    	   }
    	   
	}
dbmclose %paricipant;

print "</table>";
print "</body>";
print "</html>";