note 120293 deleted from function.array by cmb
| From: | cmb@php.net | Date: | Wed, 07 Dec 2016 16:50:17 +0000 |
| Subject: | note 120293 deleted from function.array by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208269@lists.php.net to get a copy of this message | ||
Note Submitter: bobo
----
Associative array
How to search a Value in a Array.
//File Name (test.php)
<form action="test.php" method="get">
<label for="Value_Name">Pleas insert Value (1-6)</label>
<input type="text" id="Value_Name" name="Value_Name">
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
<?php
$Database = array(
"1" => "A B, C D",
"2" => "E",
"3" => "F G H",
"4" => "I J K",
"5" => "L M N O",
"6" => "P Q, R S",
);
if(isset($_GET['submit']))
{
$Value_Name=$_GET["Value_Name"];
if($Value_Name=="")
{
echo"<p> Pleas inser a Value</p>";
}
else
{
if($Database[$Value_Name]=="")
{
echo"<p>".$Value_Name."not in the Database</p>";
}
else
{
echo"<p>".$Value_Name.":".$Database[$Value_Name]."</p>";
}
}
}
?>