I have a script which, when modified or added, automatically prints out to a system printer that I define. Here is some sample code:
$job_desc=urldecode($job_desc);
define(PRINT_CMD, " lpr -Pis ");
$prt = "-----------------------------\n";
$prt .= "| $type DRAWDOWN REQUEST |\n";
$prt .= "----------------------------- \n";
$prt .= "\n\n";
$prt .= " REPORT RUN: $today\n\n\n";
$prt .= "DATE of Request: $date\n";
$prt .= "Job #: $job_id\n";
$prt .= "Description:" . $job_desc . "\n";
// redirect $prt to system print command
$cmd="echo $prt | ".PRINT_CMD;
// execute the command
exec($cmd);
This prints fine, unless the variable $job_desc has a " AND ' in the string. If it contains " OR ' it prints fine. For example:
if $job_desc = 40" & 20" PS, then it prints fine. if $job_desc = 40" & 20" P'S, it will NOT print.
Any idea why or how I can fix this?
TIA