Jump to content

[SOLVED] Print varibles


emediastudios

Recommended Posts

I coded this file with some help from these forums some time ago and am trying to alter it to suit a different site.

 

I cant get it to show any results, im sure its simple, its just i am too.lol.

 

Code in form

<?PHP
    $query = "SELECT * FROM salon_accounts";
    $result = mysql_query($query) or die(mysql_error());
    $numrows = mysql_num_rows($result);

     if ($numrows == "0" ) {
echo "<br>There are currently no records at this time<br><br>";

} else {


     while ($row = mysql_fetch_array($result)) 
{
  echo "<form action='delete_links.php' method='post' target='_self'><br><h3>Salon Application # $row[id]<h3><table width='800' class='border'>
  <tr><input type=\"button\"class=\"fields\"value=\"Printer Friendly\"onclick=\"window.open('print_salon.php?id= <?php echo $row[id]; ?>');\">
  <td width='200' class='td2'>Company name :</td>
  <td class='td1'>$row[company_name]</td><tr>
  <td class='td2'>Trading name :</td><td class='td1'>$row[trading_name]</tr></tr>
  <td class='td2'>acn abn :</td><td class='td1'>$row[acn_abn]</tr></tr>
  <td class='td2'>Street address :</td><td class='td1'>$row[street_address]</tr></tr>
  <td class='td2'>Postal address :</td><td class='td1'>$row[postal_address]</tr></tr>
  <td class='td2'>Owners name :</td><td class='td1'>$row[owner_name]</tr></tr>
  <td class='td2'>Contact number :</td><td class='td1'>$row[contact_number]</tr></tr>
  <td class='td2'>E-mail :</td><td class='td1'>$row[email]</tr></tr>
  <td class='td2'>Salon website :</td><td class='td1'>$row[salon_website]</tr></tr>
  <td class='td2'>Contact method :</td><td class='td1'>$row[contact_method]</tr></tr>
  <td class='td2'>Contact time :</td><td class='td1'>$row[contact_time]</tr></tr>
  <td class='td2'>Survey :</td><td class='td1'>$row[survey]</tr></tr>
  <td class='comments1'>Comments :</td><td class='comments'>$row[comments]</tr></tr>
  </table> <br/>

<a href='delete_salons.php?action=delete&id=$row[id]'>DELETE FILE</a></form>";
}

}



?>

 

and this is my printing file code.

 

<?php
$id = $_GET['id'];
mysql_connect("localhost","root","5050888202");
mysql_select_db("sde");
$results = mysql_query("select * from salon_accounts where id='$id'");
while($puller=mysql_fetch_array($results)) {

// List Your Variables Like This And So On......
$variable1=$puller["id"];
$variable2=$puller["company_name"];
$variable3=$puller["trading_name"];
$variable4=$puller["acn_abn"];
$variable5=$puller["street_address"];
$variable6=$puller["postal_address"];
$variable7=$puller["owner_name"];
$variable8=$puller["contact_number"];
$variable9=$puller["email"];
$variable10=$puller["salon_website"];
$variable11=$puller["contact_method"];
$variable12=$puller["contact_time"];
$variable13=$puller["survey"];
$variable14=$puller["comments"];


}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="application/pdf" content="text/html; charset=utf-8" />
<title><?php echo "Application $variable1"?></title>
<style type="text/css"></style>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<style type="text/css">
<!--
.style1 {
color: #000000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
}
.style2 {
color: #000000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
}
.number {
color: #FF0000;
font-family: Arial, Helvetica, sans-serif;
font-size:16px;
font-weight:bold;
}

a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}

body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.sub {
color: #000000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
font-weight:bold;
}
-->
</style>

<body>
<body onload="isReady=true">
<br />
<table width="600" border="0" align="center">
  <tr>
    <td colspan="4"><span class="sub">Salon Application  :</span> <span class="number"><?php echo "$variable2"?></span> <hr /></td>
  </tr>
  <tr>
    <td colspan="3" class="style2">Company name :</td>
    <td width="64%"><span class="style1"><?php echo "$variable2"?></span></td>
  </tr>
  <tr>
    <td colspan="3" class="style2">Trading name :</td>
    <td><span class="style1"><?php echo "$variable3"?></span></td>
  </tr>
  <tr>
    <td colspan="3" class="style2">acn abn :</td>
    <td><span class="style1"><?php echo "$variable4"?></span></td>
  </tr>
  <tr>
    <td colspan="3" class="style2">Street address :</td>
    <td><span class="style2"><?php echo "$variable5"?></span></td>
  </tr>
  <tr>
    <td colspan="3" class="style2">Postal address :</td>
    <td><span class="style2"><?php echo "$variable6"?></span></td>
  </tr>
  <tr>
    <td colspan="3" class="style2">Owners name :</td>
    <td><span class="style2"><?php echo "$variable7"?></span></td>
  </tr>
  <tr>
    <td colspan="3" class="style2">Contact number :</td>
    <td><span class="style2"><?php echo "$variable8"?></span></td>
  </tr>
  <tr>
    <td colspan="3" class="style2">Contact time :</td>
    <td><span class="style1"><?php echo "$variable12"?></span></td>
  </tr>
  <tr>
    <td colspan="3" class="style2">Salon website :</td>
    <td><span class="style1"><?php echo "$variable10"?></span></td>
  </tr>
  <tr>

Link to comment
https://forums.phpfreaks.com/topic/109684-solved-print-varibles/
Share on other sites

Well you should turn on error reporing.  by adding error_reporting(E_ALL).

 

this is wrong.  you are already echoing in php. you cannot echo within an echo.

window.open('print_salon.php?id= <?php echo $row[id]; ?>');\">

 

should be:

window.open('print_salon.php?id=$row[id]');\">

 

Well you should turn on error reporing.  by adding error_reporting(E_ALL).

 

this is wrong.  you are already echoing in php. you cannot echo within an echo.

window.open('print_salon.php?id= <?php echo $row[id]; ?>');\">

 

should be:

window.open('print_salon.php?id=$row[id]');\">

 

 

Thanks man, topic solved.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.