had posted and got the some useful response regarding this code yesterday.
i had to go for drop down menu and user selects one of the 3 options in the drop downmenu. the drop down menu consists of 3 substrings.For each one, the form should be handled in such a way that after submiting each string the number of occurances of each string in the file should be printed on the screen.for each string the number of occurances should be printed finally according to the user selection.i had coded the function for the dropdown menu and for finding the number of times each string had occured.but unable to hadle the form.
can any one help me out
<body>
<?php
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
function project () { //start of the function
$strings = array ( 1 => 'string1', 'string2,', 'string3' );
print '<select name="select a string">';
foreach ($strings as $key => $value) {
print "\n<option value =\"$key\">$value</option>";
}
print '</select>';
} //end of the funtion
if (isset ($_POST['submit'])){// i am unable to code for this part help me out
if (
project();
print '<form action="view_quote.php" method="post">
<input type="submit" name="submit" value="No of Occurances!" />
<br />
</form>';
$data = file('../public_html/har.txt');
$n = substr_count($data, "srtring1");
?>
</body>
</html>