View Full Version : Advise on Print then redirect

11-17-2006, 09:07 PM
At the bottom of the following script I have onClick=window.print()
That work fine. What I need to happen is when the user clicks print, the form prints, then redirect the user to a that form again while retaining some but not all the information that was printed. How that make sense. Any thoughts?


include ("conn.php");
$id = $_POST['id'];

<body background="white" text= "#000000" link= "#A52A2A" vlink ="#A52A2A" alink= "#A52A2A"></h3>

echo "<input type = 'hidden' name = 'id' value = '$id'>";

if ($_POST['misc']!='N') $_POST['misc']=='Y';
if ($_POST['year']!='N') $_POST['year']=='Y';
if ($_POST['emergency']!='N') $_POST['emergency']=='Y';
if ($_POST['stdservice']!='N') $_POST['stdservice']=='Y';
if ($_POST['extra']!='N') $_POST['extra']=='Y';
if ($_POST['contract']!='N') $_POST['contract']=='Y';
if (isset($_POST['$description']))

$inspecteddate = $_POST['inspecteddate'];
$contactdate = $_POST['contactdate'];

if ($id == 0)
echo "ERROR: Please Try Again";

$query = "INSERT INTO csi (id,recdate, orderby,issuedate,appoint,atime, misc, year, emergency, stdservice,

contractor, description, workdoneby, compdate, ownersign,owndate, inspecteddate,extra, contract,contactdate)


'$appoint','$atime','$misc','$year','$emergency','$stdservice','$contractor','$description','$workdo neby','$c

$result = mysql_query($query) or die("Could not insert");
$woid = mysql_insert_id();




$query2 = "SELECT DATE_FORMAT(date_add(cdate,interval 365 day),'%m-%d-%Y') FROM customers where id = '$id'";
$result2 = mysql_query($query2);
$cdate = $row[0];
echo "<b>";
echo "Warranty Expires ";
echo $cdate;
echo "</b>";
echo "<br>";


$query = ("SELECT * FROM communties where community ='$community'");
$result = mysql_query($query);



<body background="white" text= "#000000" link= "#A52A2A" vlink ="#A52A2A" alink= "#A52A2A">
<h1><p align=center>The Kirk Corporation</h1><center><h4>Service Order<br><? echo $row[1];?><br><? echo

$row[2];?><br>Phone <? echo $row[3];?><br>Fax <? echo $row[4];?></h4>


$query1 = ("SELECT * FROM customers where id = '$id' ");
$result1 = mysql_query($query1);


Lot/Building <?echo $row['10']?><?echo $row['11']?><br><?echo $row[1]?></br>
<?echo $row['2']?><br>
<?echo $row['3']?>,
<?echo $row['4']?>
<?echo $row['5']?><br>
<?echo $row['6']?>


$result = mysql_query ("select

woid,id,recdate,orderby,issuedate,appoint,atime,misc,year,emergency,stdservice,contractor,descriptio n,workdon


,DATE_FORMAT(closeddate,'%m/%d/%Y'),note,DATE_FORMAT(adjdate,'%m/%d/%Y') from csi where woid = '$woid'");

$row= mysql_fetch_row($result);

echo "Work Order # $woid";


<p align = center>Contractor <input type ="text" name ="contractor" value="<?echo $row[11]?>">
Appointment Date <input type="text" name="appoint" size="8" value="<?echo date('m/d/Y',

strtotime($row['5']))?>">Time <input type = "text" name = "atime" size = 6 value="<?echo

$row[6]?>"></center><p align=center>Adjusted Date <input type="text" name="adjdate" size="8" value= "<?echo

<p align = "center">Description</center><center><textarea name = \"description\" rows= 4 cols= 60><?echo


<p align = center>Misc <input ="checkbox" name="misc" value="<?echo $row[7]?>"size = "1"> 1 Year <input

="checkbox" name="year" value="<?echo $row[8]?>"size = "1">Emergency <input ="checkbox" name="emergency"

value="<?echo $row[9]?>"size = "1">Standard Service Call <input ="checkbox" name="stdservice" value="<?echo

$row[10]?>"size = "1"></center>

<p align = center>Work done by <input type="text" name="workdoneby" size= "35" maxlength= 35 value ="<?echo

<p align = center>Signature of Owner <input type = "text" name="ownersign" size= "30" maxlength=30 value

="<?echo $row[15]?>">Date <input type ="text" name="closeddate" size="8" maxlength=8 value ="<?echo

$row[23]?>"></center> <p align=center>Above work satisfactorily completed</center> Extra

<input ="checkbox" name="extra" value="<?echo $row[17]?>"size = "1"> Contract <input ="checkbox"

name="contract" value="<?echo $row[18]?>"size = "1">

<p align = center>Construction Office</center>
<p align = center>
Received from Customer <input type="text" name="recdate" size="8" size="8" value="<?echo date('m/d/Y',

Customer Contacted <input type="text" name="contactdate" size="8"size="8" value="<?echo date('m/d/Y',

strtotime($row['21']))?>"></center><p align =center> Ordered by <input type="text" name="orderby" size="20"

maxlength=20 value ="<?echo $row[3]?>">
<body>Issued to Contractor <input type="text" name="issuedate" size="8" value="<?echo date('m/d/Y',


<input type=Submit name=Submit style="font-size:15" value="Print" onclick="window.print();">
<input type="button" value="Main" style="font-size:15" onClick="parent.location='managerstart.php'">


11-17-2006, 09:42 PM
Using PHP to generate the form dynamically, then a separate
print page using a Printer Friendly CSS style sheet. PHP script
can return/or refresh the page with different information.

Sort of more than you might need, but PHP would be the better way to go.

Javascripting can be a problem for some users.

11-17-2006, 09:50 PM
Thanks. Any idea where I might find some info on what you said?