Output to system printer

From: Date: Fri, 12 Apr 2002 14:49:38 +0000
Subject: Output to system printer
Groups: php.general 
Request: Send a blank email to php-general+get-92775@lists.php.net to get a copy of this message
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 - Bruce

« previous php.general (#92775) next »