User
I have real problems getting this PHP-script "search.php" that is called from a "form.htm" to work. What am I doing wrong here?
<?php
$old_path = getcwd();
chdir('/var/www/html/SOKHJALPMEDEL/');
$term1 = $_POST['query1'];
$argument1 = $_GET['$term1'];
$term2 = $_POST['query2'];
$argument2 = $_GET['$term2'];
echo $nu_kor_vi1;
$outcome = shell_exec("sokare $argument1 $argument2");
chdir($old_path);
echo "<pre>$outcome</pre>";
?>
The script is calling a Bash-script "sokare" that is executable systemwide and residning in "/usr/local/bin". The variables $argument1 and $argument2 are passed from the "form.htm" via $term1 = $_POST['query1']; and $term2 = $_POST['query2']; . The Bash-script looks like this. It is supposed to search any PDF-files residing in "/var/www/html/SOKHJALPMEDEL/" for pages containing both searchwords.
#!/bin/bash
pdfgrep -Hn $1 /var/www/html/SOKHJALPMEDEL/*.pdf | cut -f1,2 -d':' > /tmp/sok1.tmp
pdfgrep -Hn $2 /var/www/html/SOKHJALPMEDEL/*.pdf | cut -f1,2 -d':' > /tmp/sok2.tmp
grep -f /tmp/sok1.tmp /tmp/sok2.tmp
exit 0
I keep on getting this error in "/var/log/apache2/error.log" : PHP Notice: Undefined index: $term2 in /var/www/html/SOKHJALPMEDEL/search.php on line 7, referer: http://localhost/SOKHJALPMEDEL/form.htm
Any help clearing my mess up is beautiful:-)
/Paul
General Tech Technology & Software
1 Replies