print

sakuragi · Jul 28, 2012
mas ak pny mslh nich dengan print out menggunakan select option
yg mna tiap select option mempunyai halaman berbeda2

help me pleaseeee
print.php
<?php
session_start();
include 'conf.php';
	
$id = isset($_REQUEST['id'])?$_REQUEST['id']:'';

			$sql1 = "SELECT i.kode,i.description, DATE_FORMAT(i.tgl,'%e %b %Y'),
					DATE_FORMAT(i.tgl,'%d'),c.nama_client,c.alamat1,c.kota,DATE_FORMAT(i.tgl_kirim,'%e %b %Y')
					FROM t_salesorder i, t_client c 
					WHERE c.id=i.cust_id AND i.id='$id'";
			$res1 = mysql_query($sql1) or die(mysql_error());
			$row1 = mysql_fetch_row($res1);
			$tgl	= stripslashes($row1[2]);
			$thn	= stripslashes($row1[3]);
			$nama	= stripslashes($row1[4]);
			$alamat	= stripslashes($row1[5]);
			$kota	= stripslashes($row1[6]);
			$tgl_kirim= stripslashes($row1[7]);
			$description = stripslashes($row1[1]);


			$sql = "SELECT kode_brg,qty,unit,harga,sales_code,prod_code,nama_produk,np_detail FROM t_salesorderdetail WHERE id_so='$id'";
			$res = mysql_query($sql) or die (mysql_error()); 
			$data= array();
			
			$i	 = 0;
			while ($row = mysql_fetch_array($res)){
				$data[$i] = $row;
				$i++;
			}
			//print_r($data);
			
			?>
                                         
            <!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>
		<title>Cetak Faktur</title>
				<link rel="shortcut icon" href="images/ico/logo.gif" />
				<link href="../../../style/style.css" rel="stylesheet" type="text/css" />
				<link href="../../../script/ui/jquery.ui.all.css" rel="stylesheet" type="text/css" />
				<link href="../../../script/vtip.css" rel="stylesheet" type="text/css" />
				<script src="../../../script/jquery.js"></script>

				<script src="../../../script/jquery.currency.js"></script>
				<script src="../../../script/main.js"></script>

				<style>
					body{
						background:none;
						margin:10px;
					}
					th,td{padding:3px}

				.style1 {color: #FFFFFF}
                </style>
<script language="javascript">
   // var winref = window.open('print4.php?&id=<?php echo $id ?>','windowName','width=400,height=400');
/*function print(){
var select=document.getElementById('select').value;
window.open('print4.php?id=<?php echo $id ?>&select='+select,'windowName','width=780,height=400');
} */


function print(){
var select=document.getElementById('select').value;
var select=1;
var select=2;
if (select == 1 );
{
window.open('print4.php?id=<?php echo $id ?>&select='+select,'windowName','width=780,height=400');
}else {
window.open('print3.php?id=<?php echo $id ?>&select='+select,'windowName','width=780,height=400');
}
}
</script>

</head>

<body>
<form action='' method='post'>
<table width="80%" border="0" align="center" cellpadding="1" bordercolor="#CCCCCC" bgcolor="#FFFFFF" style="border-collapse:collapse; border-bottom-color:#000000; border-bottom-style:inherit; border:double">
					<tr>
					  <td width="10%" height='100' align='center' valign='middle'>
                      <select name="select" id="select">
                      	<option value="1">Asli</option>
                        <option value="2">Copy</option>
                        <option value="3">Produksi</option>
                      </select>                   
                      <button  type='button' value="Print" onclick="print()"><img src='images/ico/print.png' align='left' />&nbsp;&nbsp;Cetak<br />
				      Sekarang</button><?php // <input type="button" value="Print Popup" onclick="if (window.print) winref.print()">
?></td>
						<td width="90%" height='100' align='right' valign='top'>
							<table width='300' border='0' cellpadding='1'  cellspacing='1'>
								<tr height='23'><td>Bandung, <?php echo $tgl; ?></td></tr>
								<tr height='23'>
								  <td style='padding-right:10px'>Kepada Yth : <?php echo $nama; ?></td>
							  </tr>
								<tr height='23'>
								  <td style='padding-right:10px'><?php echo $alamat; ?></td>
							  </tr>
								<tr height='23'>
								  <td style='padding-right:10px'><?php echo $kota; ?></td>
							  </tr>
							</table>						</td>
					</tr>
					<tr>
						<td align='left' colspan='2'>
                        
                        

<table width='1008' border='1' align="center" cellpadding='0'  cellspacing='0'  style="border-collapse:collapse; border:solid 1px #000">
							
<tr height='25'>
									<th rowspan="2" bgcolor="#999999"><span class="style1">No</span></th>
		    <th rowspan="2" bgcolor="#999999"><span class="style1">Kode Barang</span></th> 
            <th colspan="2" bgcolor="#999999"><span class="style1">Code</span></th>
            <th rowspan="2" bgcolor="#999999"><span class="style1">Nama Produk</span></th>
            <th rowspan="2" bgcolor="#999999"><span class="style1">Qty</span></th>
		    <th rowspan="2" bgcolor="#999999"><span class="style1">Units</span></th>
		    <th rowspan="2" bgcolor="#999999"><span class="style1">Harga</span></th>
		    <th rowspan="2" bgcolor="#999999"><span class="style1">Subtotal</span></th>
		  </tr>
                                	<tr height='25'>
									  <th bgcolor="#999999"><span class="style1">Sales</span></th>
									  <th bgcolor="#999999"><span class="style1">Prod</span></th>
		  </tr>
								<?php
								
								$sub = 0;
								foreach($data as $row)
								//for ($i=0;$i<soListNumber;$i++)
								{
									?>
								
									<tr height='25'>
										<td width='37' align="center"><?php echo $i++; ?></td>
										<td width='188'><?php echo ($row['kode_brg']); ?><br /></td>
										<td width='48' align='center'><?php echo $row['sales_code']; ?><br /></td>
										<td width='66' align='center'><?php echo $row['prod_code']; ?><br /></td>
										<td width='171' align='right'><?php echo $row['nama_produk']; ?><br /><?php echo $row['np_detail']; ?></td>
										<td width='57' align='right'><?php echo $row['qty']; ?><br /></td>
										<td align='center' width='81'><?php echo $row['unit']; ?><br /></td>
										<td align='right' width='170' style='padding-right:5px'><?php echo "Rp. ".number_format($row['harga'],2 , ',' , '.'); ?>                                    <br /></td>
										<td align='right' width='170' style='padding-right:5px'><?php echo "Rp. ".number_format($row['harga']*$row['qty'],2 , ',' , '.'); ?><br /></td>
									</tr>
									<?php
									$sub += ($row[1]*$row[3]);
								}
								?>
							</table>
				      <br>
							<table width='891' border='0' align="center" cellpadding='0'  cellspacing='0'>
						  <tr height='25'>
									<td colspan='4' rowspan='3'>
										<table border='0'>
											<tr height='70'>
												
										  <td width="78" align='center' valign='bottom'>
					Marketing<br>
													<br><br><br />(............)												</td>
											  <td width="48" align='center' valign='bottom'>&nbsp;</td>
												<td width="96" align='center' valign='bottom'>
								          Menyetujui<br>
													<br><br>
													<br />(...........)												</td>
										  </tr>
								  </table>									</td>
									<td width="236">&nbsp;</td>
								  <td width="251" align='right' style='padding-right:5px'>Total</td>
								  <td width="168" align='right' style='padding-right:5px'><?php echo "Rp. ".number_format($sub,2 , ',' , '.'); ?></td>
								</tr>
								<tr height='25'>
									<td>&nbsp;</td>
								  <td align='right' style='padding-right:5px'>Tgl Kirim</td>
								  <td align='right' style='padding-right:5px'><?php echo $tgl_kirim; ?></td>
								</tr>
							</table>						</td>
					</tr>
					<tr>
					  <td align='left' colspan='2'>&nbsp;</td>
				  </tr>
					<tr>
					  <td align='left'>&nbsp;</td>
					  <td>&nbsp;&nbsp;
				      <input type="button" value="Kembali" class="buttonStyle" onclick="window.location='Indexso.php'" style="color:#0066FF; background-color:#00FF00"/></td>
    </tr>
				</table>
</form>
</body>
</html>

print3.php
<?php
include 'conf.php';

$id = isset($_REQUEST['id'])?$_REQUEST['id']:'';
$select=$_REQUEST['select']?$_REQUEST['select']:'';
/*switch ($select){
case 1:$jenis="ASLI";
break;
case 2:$jenis="COPY";
break;
case 3:$jenis="MEMO <br>PRODUKSI";
break;

}*/
$sql1 = "SELECT i.kode,i.description, DATE_FORMAT(i.tgl,'%e %b %Y'),
					c.nama_client,c.kode_client,c.alamat1,c.kota,DATE_FORMAT(i.tgl_kirim,'%e %b %Y')
					FROM t_salesorder i, t_client c 
					WHERE c.id=i.cust_id AND  i.id='$id'";
$res1 = mysql_query($sql1) or die(mysql_error());
$row1 = mysql_fetch_row($res1);
$tgl	= stripslashes($row1[2]);
$kode_client = stripslashes($row1[4]);
$nama	= stripslashes($row1[3]);
$kode	= stripslashes($row1[0]);
$tgl_kirim= stripslashes($row1[7]);

$description = stripslashes($row1[1]);

$sql = "SELECT kode_brg,sales_code,prod_code,nama_produk,qty,unit,harga,np_detail FROM t_salesorderdetail WHERE id_so='$id'";
$res = mysql_query($sql) or die (mysql_error()); 
$data= array();;
$i	 = 0;
while ($row = mysql_fetch_row($res)){
	$data[$i] = $row;
	$i++;
}
//print_r($data);
?>
<!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="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
th,td{padding:3px}

body{ font-size:14px; font-weight:normal; font-family:Arial}
.style3 {
	font-size: 16px;
	font-family: "Berlin Sans FB";
}
.style5 {
	font-size: 13px;
	font-family: "Berlin Sans FB";
}
.style18 {font-family: Calibri; font-weight: bold; font-size: 11px; }
.style23 {font-size: 10px}
.style24 {
	font-family: "AvantGarde Md BT";
	font-size: 14px;
}
.style25 {font-size: 11px; font-family: Calibri;}
.style26 {font-family: "Berlin Sans FB"; font-size: 10; }
.style32 {font-size: 18px}
.style34 {font-family: Arial; font-size: 12px; font-style: italic; }
.style35 {font-size: 13px}
</style>
</head>

<body>
<table width="100%" border="0" cellpadding="2">
  <tr>
    <td scope="row">
    	<table width="100%" border="0" cellpadding="0">
          <tr>
            <td width="267" class="style24 style32" scope="row">VIARA Plastics</td>
            <td colspan="3">&nbsp;</td>
            <td width="80">&nbsp;</td>
          </tr>
          <tr>
            <td scope="row"><span class="style3">Sales Order</span></td>
            <td width="240"  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $tgl?></span></td>
            <td width="441"  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $kode?></span></td>
            <td width="441" >&nbsp;</td>
            <td rowspan="2" align="center"><strong class="style3">MEMO<br />
            PRODUKSI</strong></td>
          </tr>
          <tr>
            <td scope="row"><span class="style5">Customer</span></td>
            <td  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $kode_client; ?></span></td>
            <td  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $nama; ?></span></td>
            <td  >&nbsp;</td>
          </tr>
        </table>
    </td>
  </tr>
  <tr>
    <td scope="row">
        <table width="70%" border="1" cellpadding="0" style="border:1px solid #000; border-collapse:collapse">
            <tr>
                <td width="3%" rowspan="2" align="center" scope="row" style="padding-top:20px"><span class="style26">No.</span></td>
              <td width="17%" rowspan="2" align="center" style="padding-top:20px"><span class="style26" >Kode Barang</span></td>
              <td colspan="2" align="center"><span class="style26">Code</span></td>
              <td width="25%" rowspan="2" align="center" style="padding-top:20px"><span class="style26" style="padding-top:20px">Nama Produk</span></td>
              <td width="7%" rowspan="2" align="center" style="padding-top:20px"><span class="style26">Qty</span></td>
              <td width="5%" rowspan="2" align="center" style="padding-top:20px"><span class="style26">Units</span></td>
<?php  if ($select==1 || $select ==2){
				
				?>
			  <?php } ?>
            </tr>
            <tr>
                <td width="5%" align="center"><span class="style26">Sales</span></td>
              <td width="5%" align="center"><span class="style26">Prod</span></td>
          </tr>
            
            <?php
			$i=1;
			$total = 0;
			foreach($data as $row)
			{
			?>
            <tr>
                <td align="center" width="3%"><em><?php echo $i; ?></em></td>
              <td width="17%" ><em><?php echo $row[0]; ?></em></td>
              <td align="center"width="5%" ><em><?php echo $row[1]; ?></em></td>
              <td align="center"width="5%" ><em><?php echo $row[2]; ?></em></td>
              <td width="25%" ><em><?php echo $row[3]; ?><br />
              <?php echo $row[7]; ?></em></td>
              <td align="right" width="7%"><em><?php echo $row[4]; ?></em></td>
              <td align="center" width="5%"><em><?php echo $row[5]; ?></em></td>
              <?php if ($select==1 || $select ==2){
				?><?php } ?>
            </tr>
            <?php
            $i++;
			$total += ($row[4]*$row[6]);
			}
			?>
        </table>

    </td>
  </tr>
  <tr>
    <td scope="row">
    	<table width="100%" border="0" cellpadding="0">
          <tr>
            <td width="25%">&nbsp;</td>
            <td width="22%">&nbsp;</td>
           <?php  if ($select==3){
				
				?> <td width="23%">&nbsp;</td>
            <?php } ?>
            <td align="right">
                <table width="163" border="0" cellpadding="1">
  <tr> <?php if ($select==1 || $select ==2) { ?> 
                    <td width="70"><span class="style18"><span class="style35">TOTAL Rp</span>.</span></td>
                  <td width="83" align="right"  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><em><?php echo number_format($total,0 , ',' , '.'); ?></em></td>
                <?php }?></tr>
                  <tr>
                    <td><span class="style25"><span class="style5">Tgl Kirim </span></span><span class="style18">:</span></td>
                    <td  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><em><strong><?php echo $tgl_kirim; ?></strong></em></td>
                  </tr>
            </table>            </td>
          </tr>
          <tr>
            <td align="center" class="style26">Marketing</td>
            <td align="center"><span class="style26">Menyetujui</span></td>
            <?php  if ($select==3){
				
				?> <td align="center"><span class="style26">PPIC</span></td>
            <?php } ?>
            <td rowspan="2" align="right"><textarea cols="30" rows="5" style="border:solid 1px #000000; border-collapse:collapse">Keterangan :<?php echo $description ?> </textarea>            	            </td>
          </tr>
          <tr height="100">
            <td align="center"><br /><br />(....................................)</td>
            <td align="center"><br /><br />(....................................)</td>
            <?php  if ($select==3){
				
				?> <td align="center"><br /><br />(....................................)</td><?php } ?>
          </tr>
        </table>

    </td>
  </tr>
  <tr>
    <td scope="row"><span class="style23"></span></td>
  </tr>
</table>

</body>
</html>
<script>
window.print();
</script>

prin4.php
<?php
include 'conf.php';

$id = isset($_REQUEST['id'])?$_REQUEST['id']:'';
$select=$_REQUEST['select']?$_REQUEST['select']:'';
switch ($select){
case 1:$jenis="ASLI";
break;
case 2:$jenis="COPY";
break;
/*case 3:$jenis="MEMO <br>PRODUKSI";
break;
*/
}
$sql1 = "SELECT i.kode,i.description, DATE_FORMAT(i.tgl,'%e %b %Y'),
					c.nama_client,c.kode_client,c.alamat1,c.kota,DATE_FORMAT(i.tgl_kirim,'%e %b %Y')
					FROM t_salesorder i, t_client c 
					WHERE c.id=i.cust_id AND  i.id='$id'";
$res1 = mysql_query($sql1) or die(mysql_error());
$row1 = mysql_fetch_row($res1);
$tgl	= stripslashes($row1[2]);
$kode_client = stripslashes($row1[4]);
$nama	= stripslashes($row1[3]);
$kode	= stripslashes($row1[0]);
$tgl_kirim= stripslashes($row1[7]);

$description = stripslashes($row1[1]);

$sql = "SELECT kode_brg,sales_code,prod_code,nama_produk,qty,unit,harga,np_detail FROM t_salesorderdetail WHERE id_so='$id'";
$res = mysql_query($sql) or die (mysql_error()); 
$data= array();;
$i	 = 0;
while ($row = mysql_fetch_row($res)){
	$data[$i] = $row;
	$i++;
}
//print_r($data);
?>
<!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="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
th,td{padding:3px}

body{ font-size:14px; font-weight:normal; font-family:Arial}
.style3 {
	font-size: 16px;
	font-family: "Berlin Sans FB";
}
.style4 {
	font-size: 20px;
	font-weight: bold;
	font-family: Arial, Helvetica, sans-serif;
}
.style5 {
	font-size: 13px;
	font-family: "Berlin Sans FB";
}
.style18 {font-family: Calibri; font-weight: bold; font-size: 11px; }
.style23 {font-size: 10px}
.style24 {
	font-family: "AvantGarde Md BT";
	font-size: 14px;
}
.style25 {font-size: 11px; font-family: Calibri;}
.style26 {font-family: "Berlin Sans FB"; font-size: 10; }
.style32 {font-size: 18px}
.style34 {font-family: Arial; font-size: 12px; font-style: italic; }
.style35 {font-size: 13px}
</style>
</head>

<body>
<table width="100%" border="0" cellpadding="2">
  <tr>
    <td scope="row">
    	<table width="100%" border="0" cellpadding="0">
          <tr>
            <td width="267" class="style24 style32" scope="row">VIARA Plastics</td>
            <td colspan="3">&nbsp;</td>
            <td width="80">&nbsp;</td>
          </tr>
          <tr>
            <td scope="row"><span class="style3">Sales Order</span></td>
            <td width="240"  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $tgl?></span></td>
            <td width="441"  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $kode?></span></td>
            <td width="441" >&nbsp;</td>
            <td rowspan="2" align="center"><span class="style4">
			<?php echo $jenis
			?></span></td>
          </tr>
          <tr>
            <td scope="row"><span class="style5">Customer</span></td>
            <td  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $kode_client; ?></span></td>
            <td  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><span class="style34"><?php echo $nama; ?></span></td>
            <td  >&nbsp;</td>
          </tr>
        </table>
    </td>
  </tr>
  <tr>
    <td scope="row">
        <table width="100%" border="1" cellpadding="0" style="border:1px solid #000; border-collapse:collapse">
            <tr>
                <td width="3%" rowspan="2" align="center" scope="row" style="padding-top:20px"><span class="style26">No.</span></td>
              <td width="17%" rowspan="2" align="center" style="padding-top:20px"><span class="style26" >Kode Barang</span></td>
              <td colspan="2" align="center"><span class="style26">Code</span></td>
              <td width="25%" rowspan="2" align="center" style="padding-top:20px"><span class="style26" style="padding-top:20px">Nama Produk</span></td>
              <td width="7%" rowspan="2" align="center" style="padding-top:20px"><span class="style26">Qty</span></td>
              <td width="5%" rowspan="2" align="center" style="padding-top:20px"><span class="style26">Units</span></td>
<?php  if ($select==1 || $select ==2){
				
				?>
				 <td width="10%" rowspan="2" align="center"><span class="style26">Harga <br />
		      per Unit</span></td>
              <td width="15%" rowspan="2" align="center"><span class="style26">Subtotal <br />
              (Rp.)</span></td> 
              <?php } ?>
            </tr>
            <tr>
                <td width="5%" align="center"><span class="style26">Sales</span></td>
              <td width="5%" align="center"><span class="style26">Prod</span></td>
          </tr>
            
            <?php
			$i=1;
			$total = 0;
			foreach($data as $row)
			{
			?>
            <tr>
                <td align="center" width="3%"><em><?php echo $i; ?></em></td>
              <td width="17%" ><em><?php echo $row[0]; ?></em></td>
              <td align="center"width="5%" ><em><?php echo $row[1]; ?></em></td>
              <td align="center"width="5%" ><em><?php echo $row[2]; ?></em></td>
              <td width="25%" ><em><?php echo $row[3]; ?><br />
              <?php echo $row[7]; ?></em></td>
              <td align="right" width="7%"><em><?php echo $row[4]; ?></em></td>
              <td align="center" width="5%"><em><?php echo $row[5]; ?></em></td>
              <?php if ($select==1 || $select ==2){
				?><td align="right" width="10%"><em><?php echo number_format($row[6],0 , ',' , '.'); ?></em></td>
              <td align="right" width="15%"><em><?php echo number_format($row[4]*$row[6],0 , ',' , '.'); ?></em></td>
              <?php } ?>
            </tr>
            <?php
            $i++;
			$total += ($row[4]*$row[6]);
			}
			?>
        </table>

    </td>
  </tr>
  <tr>
    <td scope="row">
    	<table width="100%" border="0" cellpadding="0">
          <tr>
            <td width="25%">&nbsp;</td>
            <td width="22%">&nbsp;</td>
           <?php  if ($select==3){
				
				?> <td width="23%">&nbsp;</td>
            <?php } ?>
            <td align="right">
                <table width="163" border="0" cellpadding="1">
  <tr> <?php if ($select==1 || $select ==2) { ?> 
                    <td width="70"><span class="style18"><span class="style35">TOTAL Rp</span>.</span></td>
                  <td width="83" align="right"  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><em><?php echo number_format($total,0 , ',' , '.'); ?></em></td>
                <?php }?></tr>
                  <tr>
                    <td><span class="style25"><span class="style5">Tgl Kirim </span></span><span class="style18">:</span></td>
                    <td  style="border-left:solid 1px #000; border-bottom:solid 1px #000; border-right:solid 1px #000 ; border-top: solid 1px #000"><em><strong><?php echo $tgl_kirim; ?></strong></em></td>
                  </tr>
            </table>            </td>
          </tr>
          <tr>
            <td align="center" class="style26">Marketing</td>
            <td align="center"><span class="style26">Menyetujui</span></td>
            <?php  if ($select==3){
				
				?> <td align="center"><span class="style26">PPIC</span></td>
            <?php } ?>
            <td rowspan="2" align="right"><textarea cols="30" rows="5" style="border:solid 1px #000000; border-collapse:collapse">Keterangan :<?php echo $description ?> </textarea>            	            </td>
          </tr>
          <tr height="100">
            <td align="center"><br /><br />(....................................)</td>
            <td align="center"><br /><br />(....................................)</td>
            <?php  if ($select==3){
				
				?> <td align="center"><br /><br />(....................................)</td><?php } ?>
          </tr>
        </table>

    </td>
  </tr>
  <tr>
    <td scope="row"><span class="style23"></span></td>
  </tr>
</table>

</body>
</html>
<script>
window.print();
</script>

Lihat semua 6 jawaban

Silahkan login untuk menjawab!
Om mu bertanya lagi nich, langsung sya posting aja sourcenya.
$sql = "UPDATE tbkeg SET nm_keg='{$_POST['txtnmkeg']}', tgl='{$_POST['txttgl']}',kontak_p='{$_POST['txtkontak']}',periode='{$_POST['cboperiode']}' WHERE id = '{$_POST['txtid']}'";
		$hasil = mysql_query($sql);
tolong gimana caranya biar sintaks sql tersebut yg pada bagian "txttgl" bisa nyimpen or update.
coz yg ada skrang pada bagian tgl didatabasenya slalu "0000-00-00" maunya saya bisa nyimpen dengan format "dd/mm/yyyy". Terimkasih:D

Lihat semua 3 jawaban

Silahkan login untuk menjawab!

MEMBUAT RANDOM SOAL

_FB_NAME_ · Jul 28, 2012
sy mau tanya.
sy buat random soal. soal yang saya tampilkan 1 page 1 soal.
sy sudah berhasil ngacak soal-nya.
yang sy tanyakan. bagaimana caranya agar soal yang ditampilkan itu tidak 2,3 atau 4 kali.
karena setiap sy jalankan ujian. soal tersebut akan tampil 2 kali.

tolong beri pencerahan. trims

Lihat semua 2 jawaban

Silahkan login untuk menjawab!

tampil foto

deny · Jul 28, 2012
permisi mas Ellyx, kemaren saya udah berhasil upload foto ke folder. tinggal nampilinnya nih mas Ellyx. saya gak bisa bisa nampilinnya. mohon bantuannya y mas..script ulpoadnya signup.php dan buat nampilinnya status.php
    <?php
      if (isset($_POST['daftar']))
      {
      include "./config/conn.php";
      $nama=ucwords($_POST['nama']);
      $kota_asal=$_POST['kota_asal'];
      $user=$_POST['user'];
      $email=$_POST['email'];
      $password=md5($_POST['password']);
      //upload gambar
	  $foto = $_FILES['foto']['name'];
	  $size = $_FILES['foto']['size'];
	  $error = $_FILES['foto']['error'];
	  if($size > 0 && $error == 0){
      move_uploaded_file($_FILES['foto']['tmp_name'], 'images/'.$foto);
      $foto=$_FILES['foto']['name'];
      }
      if (!empty($nama) && !empty($kota_asal) && !empty($foto) && !empty($user) && !empty($email) && !empty($password))
      {
      $cek=mysql_db_query($db,"select * from daftar where user='$user'",$koneksi);
      $valid=mysql_num_rows($cek);
      if ($valid){
      echo "<script> document.location.href='signup.php?status=<font color=red>Maaf, USERNAME Anda sudah ada yang punya!!</font>'; </script>";
      }else{
      $insert=mysql_db_query($db,"insert into daftar(nama,kota_asal,foto,user,email,pass,tanggal) values('$nama','$kota_asal','$foto','$user','$email','$password','$tanggal')",$koneksi);
      if ($insert)
      {
      echo "<script> document.location.href='signup.php?status=Selamat bergabung dengan situs kami.'; </script>";
      }
      }
      }
      else
      {
      echo "<script> document.location.href='signup.php?status=<font color=red>Maaf, Data yang anda kirim belum lengkap!!</font>'; </script>";
      }
       }
      ?>
<html>
<head>
<title>SignUp</title>
<script language="javascript">
<!--
function tutup()
{
	top.window.close()
}
//-->
</script>
</head>
<body>

<center>
<table width="100%" cellspacing="2" cellpadding="2" >
<tr>
<td bgcolor='#0033FF' colspan="2"><div align="center">
	<font color="#FFFFFF" face="Geneva, Arial, Helvetica, sans-serif"><strong>[DAFTAR SLANKER/SLANKY]</strong></font></div>
</td>	
<tr>
	<td>&nbsp;</td>
</tr>
<tr>
	<td valign="top">&nbsp;</td>
	<td>
		<form name="daftar" action="signup.php" method="post" enctype="multipart/form-data">
		<table width="100%" cellspacing="2" cellpadding="2" >
			<tr>
				<td><font face="verdana" size="2">Nama Lengkap</font></td>
				<td><input type="text"  dir="ltr" size="25" name="nama"><td>
			</tr>
			
			<tr>
			  <td>Kota asal</td>
			  <td><label for="textfield"></label>
			    <input type="text" name="kota_asal" id="textfield"></td>
		    </tr>
			<tr>
			  <td>Foto</td>
			  <td><input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
<input type="file" name="foto"></td>
		    </tr>
			<tr>
				<td><font face="verdana" size="2">User name</font></td>
				<td><input type="text" size="10" name="user"></td>
			</tr>
			
			<tr>
				<td><font face="verdana" size="2">Email</font></td>
				<td>
				<input type="text" size="25" name="email"></td>
			</tr>
			
			<tr>
				<td height="30"><font face="verdana" size="2">Password</font></td>
				<td><input type="password" size="10" name="password">
				<font size="-1" color="#A0A0A4" face="verdana"> (Max 6 digit 0-9 a-z case sensitif)</font></td>
			</tr>
			
			<tr>
				<td></td><td><p>
				  <input type="submit" value="Kirim" name="daftar">
			      &nbsp;
			      <input type="button" onClick="tutup()" value="Keluar">
				  </p>
				  </td>
			</tr>
		</table>
		</form><br>
		<p align="center"><font color="#0033FF" face='verdana' size='2'><blink><? echo $_GET['status'] ?></blink></font><br></p>
	</td>
</tr>
</tr>
</table>

</center>
</body>
</html>

Lihat semua 5 jawaban

Silahkan login untuk menjawab!
Mas sory nee nanya mulu,,, hehe :D
berdasarkan script yang mas kasih kmaren2, di
Multiple upload langsung ke db
untuk multiple upload yang pernah mas kasih kmaren2 itu ternyata gambar yang di upload tertulis di db nya hanya ke satu field mas,, saya pengen gambar2 tersebut masuk kedalam field2 yang berbeda gimana mas...??
help me :)

Lihat semua 7 jawaban

Silahkan login untuk menjawab!
Sore semua
Mau tanya nih
Ada masalah pada pencarian saya

Tabel Produk
d_produk *
Id_kategori **
Nama_produk
Deskripsi
Harga
Stok
Tanggal_masuk
Gambar
Proses_produksi

Tabel Kategori
Id_kategori *
Nama_kategori
Tampil_kategori
Alamat_halaman

pencarian.php
<div id="top-search">
<form action="hasil_pencarian.php" method="post">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="text" name="cari" value="Search" onblur="if (this.value=='') { this.value='Search'; }" onfocus="if (this.value=='Search') { this.value=''; }" class="top-search-inp" /></td>
<td>
<select class="styledselect" name="pencarian">
<option>-Pilih-</option>
<?
mysql_connect("localhost","root","");
mysql_select_db("nama_db_saya");
$tampil="select * from kategori where tampil_kategori='tampil' "; //$tampil="SELECT * FROM produk,kategori WHERE produk.id_kategori=kategori.id_kategori and kategori.tampil_kategori='tampil'"; $hasil = mysql_query($tampil); while($r=mysql_fetch_array($hasil))
{
echo"<option value=$r[id_kategori]>$r[nama_kategori]</option>"; }
?>
</select>
</td>
<td>
<input type="submit" value="Cari" name="submit">
</td>
</tr>
</table>
</form>
</div>

hasil_pencarian.php

<?php
$dbHost = "localhost";
$dbUser = "root";
$dbPass = "";
$dbDatabase = "nama_db_saya";

//connet to the database

$db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("I cannot connect to the database because: " . mysql_error());
mysql_select_db("$dbDatabase", $db) or die ("I cannot select the database '$dbname' because: " . mysql_error());

if (isset($_POST)) {
$cari = $_POST;
$pencarian = $_POST;

$sql="select * from produk,kategori where produk.id_kategori=kategori.id_kategori and produk.id_kategori LIKE '%$cari%'";
$result = mysql_query($sql) or die('Error, searching failed. ' . mysql_error());

if (mysql_num_rows($result) == 0) {
echo "<script>alert('Pencarian tidak ditemukan')</script>";
echo"<script>location='pencarian4.php'</script>";
} else {
echo '<p></p>';
while ($row = mysql_fetch_array($result)) {
echo"
$row[nama_produk]<br>
$row[harga]<br>
$row[stok]<br>
";
}
}
}
?>

Nah kira2 salah di mana tuh ya ??
Yang saya mau klo saya isi kata kunci maka akan muncul semua data yg berhubungan dari tabel produk
Udah 2 hari gak Solved
Kok hasil yg muncul data tidak ditemukan terus
Klo pencarian 1 tabel saya udah bisa tapi kalo berelasi kaya di atas masih bingung
Tolong bantuannya ya

Lihat semua 1 jawaban

Silahkan login untuk menjawab!