-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path15_cautare_string.php
More file actions
51 lines (43 loc) · 1.18 KB
/
Copy path15_cautare_string.php
File metadata and controls
51 lines (43 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
include("header.php");
require("11_functii_lib.php");
if (isset( $_POST['cuvant_cheie'])) {
$cuvant_cheie = $_POST['cuvant_cheie'];
if ( strlen($cuvant_cheie) > 0 ) {
$fileHandler = fopen("zzz_example.csv", "r");
$result = array();
$i = 1;
while ( !feof($fileHandler)) {
$linie = fgets($fileHandler);
$pos = strpos($linie, $cuvant_cheie);
if ($pos !== false){
array_push($result, "Linia $i");
}
$i++;
}
fclose($fileHandler);
if (count($result) > 0) {
myArrayPrint($result);
}
else {
echo "Cuvantul nu se afla in fisier";
}
}
}
?>
<form action="15_cautare_string.php" method="POST" name="" class="form-horizontal" id="" >
<div class="form-group">
<label class="col-sm-2">Cuvant cheie</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="cuvant_cheie" maxlength="30" />
</div>
</div>
<div class="form-group">
<div class="col-sm-12 col-sm-offset-2">
<button type="submit" name="cauta" class="btn btn-warning">Cauta</button>
</div>
</div>
</form>
<?php
include("footer.php");
?>