Hi all,
When I use the "find" and "grep" command on SSH shell gives me correct results.
But when i use the same line in PHP....It's not working.

The line of code is

find 2008-06* -name "*.ps" -exec grep -i -e "lastname, firstname " {} \;

In above I am giving the last name and first name when I execute that code in SSH.
But when I am writing the above code in PHP , Its not giving me results. Here I want users to enter the last name and first name ( that will be one HTML codede page and then on submit it will redirect to the page where I have written the find code) and accordingly search will be done.
My PHP script is

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
$title = "Grading Form";
echo "Hello";
if(isset($_POST['fname'])) { $f1 =  $_POST['fname']; }
echo $f1;
if (isset($_POST['lname'])) { $ll =  $_POST['lname']; }
if (isset($_POST['add'])) { $a1 =  $_POST['add']; }
if (isset($_POST['date'])) { $d1 =  $_POST['date']; }
$query = ' find $date -name    "*.ps"  -exec grep  -i -e $lname, $fname {} \ ' ;
?>

Actually, We have one dictionary which contains lots of files. So When user enters information about particular file the code should first find the file( file would be in .ps n .pdf format) than will ask for the option to print. And then print accordingly.

    well you arent executing a query there... your just assigning it to a variable

    See: Shell_Exec

      Write a Reply...