HTML FORM CODE
(accessible on the index page of www.minfinrdc.com, in the Topic "Services En Ligne" at left)
<!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>Suivi de dossier</title>
</head>
<p><body>
<h3>Recherche de :</h3>
<form method="post" action="search_byndossier.php?go" id="searchform">
<input type="text" name="name">
<input type="submit" name="submit" value="Chercher">
</form>
</body>
</html>
PHP CODE
<?php
if(isset($_POST['submit'])){
if(isset($_GET['go'])){
if(preg_match("/^[ a-zA-Z]+/", $_POST['name'])){
$name=$_POST['name'];
//connect to the database
$db=mysql_connect ("localhost", "user", "pass") or die ('Impossible de se connecter parceque : ' . mysql_error());
//-select the database to use
$mydb=mysql_select_db("minfincd_sc100");
//-query the database table
$sql="SELECT * FROM sc_dossier WHERE ndossier =" . $name;
//-run the query against the mysql query function
$result=mysql_query($sql);
//-create while loop and loop through result set
while($row=mysql_fetch_array($result)){
$ndossier =$row['Numero'];
$sdossier =$row['Statut'];
$ldossier =$row['Localisation'];
$odossier =$row['Observation'];
//-display the result of the array
echo "<ul>\n";
echo "<li>" . $ndossier. "</li>\n";
echo "<li>" .$sdossier. "</li>\n";
echo "<li>" .$ldossier. "</li>\n";
echo "<li>" . $odossier . "</a></li>\n";
echo "</ul>";
}
}
else{
echo "<p>Veuillez saisir une requĂȘte de recherche</p>";
}
}
}
?>