note 120297 deleted from function.array by sobak
| From: | sobak@php.net | Date: | Thu, 08 Dec 2016 08:12:52 +0000 |
| Subject: | note 120297 deleted from function.array by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208276@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Here a short sample how to search for a Value in an Array:
<html>
<head>
</head>
<body>
<form>
<label for="Value">Search for a Value:</label>
<input type="text" name="Value" id="Value"
maxlength="50"><br>
<input type="submit" name="submit" id="submit">
</form>
<?php
$array = array('A' => 'textin A',
'B' => 'text in B',
'C' => 'text in C');
if (isset($_GET["submit"])) {
$Value=$_GET["Value"];
if($array[$Value]=="")
{
echo"Value was not found";
}
else
{
echo"<p>".$Value.":".$array[$Value]."</p>";
}
}
?>
</body>
</html>