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
[code=sh]
find 2008-06* -name "*.ps" -exec grep -i -e "lastname, firstname " {} \;
[/code]
In above I am giving the last name and first name.
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 and accordingly search will be done.
My PHP script is
[code=php]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<?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 {} \ ' ;
?>
[/code]
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
[code=sh]
find 2008-06* -name "*.ps" -exec grep -i -e "lastname, firstname " {} \;
[/code]
In above I am giving the last name and first name.
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 and accordingly search will be done.
My PHP script is
[code=php]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<?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 {} \ ' ;
?>
[/code]
Comment