Hi All,
I have a page in which user can enter first name,last name , date and according to that My script should search for the records which matches the above last n first names and print it.
I have the below code,
But seems not working..
<?php
$title = " Form";
echo "Hello";
if(isset($_POST['fname'])) { $f1 = $_POST['fname']; }
if (isset($_POST['lname'])) { $ll = $_POST['lname']; }
if (isset($_POST['add'])) { $a1 = $_POST['add']; }
if (isset($_POST['date'])) { $d1 = $_POST['date']; }
$fullname = $l1.","f1;
echo "$fullname;
$dirname = "/home/gr/ereports/O1" ;
$handle = opendir($dirname) or print "cant open";
$ans = shell_exec("find /home/gr/ereports/O1/$d1 -name \*.ps -exec grep -i -e "$fullname" {} \; -print; ");
?>
If i go on shell to home/gr/ereports/O1 and then write the code as below
find dirname -name "*.ps" -exec grep -i -e "CAK, SO" {} \; -print ;
Here in above "CAK , SO" in which CAK is the lastname n SO is the first name
its giving me the result perfectly.
I am thinking that the way I used the above statment in PHP is wrong..
Can anybody help me...
Thanks