Mohon maaf teman-teman dan bang ellyx mau tanya nich... saya punya masalah ketika akan print. yang jadi permasalahan yaitu... 1/2 kertas quarto continuous form agar bisa muat banyak dan huruf besar-besar, maka margin atas bawah kanan kiri seminim mungkin. dan bisa kah bentuknya di tetapkan.. misalnya untuk 1/2 halaman quarto continuous form maximum bisa memuat 5 item barang (jadi walau 1 barang hasil print nya tetap seperti 5 barang..jadi yang lainnya kosong hanya ada 1 item yang ke print-intinya bentuk tabel nya tetap semaksimum 1/2 quarto walau isinya cuma ada 1 barang ), jika lebih menggunakan 1 halaman quarto... berikut scrip yang sudah saya buat..
<? session_start();
$nama = $_SESSION['username'];
 ?>
<!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=iso-8859-1" />
<title>Untitled Document</title>
<? include "koneksi.php"; ?>
<script type="text/javascript">

function printpage()

{

window.print()

}

</script>
<link rel="shortcut icon" href="images/kent.ico" >
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>

<?php
include "koneksi.php";
$id=$_POST['id1'];

$sql = mysql_query("SELECT * FROM penjualan WHERE id_penjualan = $id");
$hasil = mysql_fetch_array($sql);
$idc = $hasil['id_costumer'];
$ids = $hasil['id_sales'];
$costumer = mysql_query("SELECT * FROM costumer WHERE id_costumer = $idc ");
$hasilc = mysql_fetch_array($costumer);
$sales = mysql_query("SELECT * FROM sales WHERE id_sales = $ids ");
$hasils = mysql_fetch_array($sales);
?>

<body>
<div id="wrapper">
<div id="divso">
	<table id="so">
		<tr>
			<td colspan="3" align="center"><font size="3"><b>Sales Order</b></font></td>
		</tr>
		<tr>
			<td height="20" align="center"><font size="2">No : <b><? echo $hasil['no_so'] ?></b></font></td>
		</tr>
	</table>
</div>
<div id="batas"></div>
<div id="divco">
   <form method="post">
	<table id="company" height="118" cellspacing="0" cellpadding="0" vspace="0">
		<tr class="company">
			<td width="100" height="19">Company</td>
			<td width="25">:</td>
			<td width="250" colspan="4"><? echo $hasilc['nama_costumer']; ?></td>
		</tr>
		<tr class="company">
			<td height="19">Address</td>
			<td>:</td>
			<td colspan="4"><? echo $hasilc['alamat']; ?></td>
		</tr>
		<tr class="company">
			<td height="19">Attention</td>
			<td>:</td>
			<td colspan="4"><? echo $hasilc['attention']; ?></td>
		</tr>
		<tr class="company">
			<td height="19">Position</td>
			<td>:</td>
			<td colspan="4"><? echo $hasilc['posisi']; ?></td>
		</tr>
		<tr class="company">
			<td height="19">Telp.</td>
			<td>:</td>
			<td><? echo $hasilc['telepon']; ?></td>
			<td width="47">&nbsp;Fax.</td>
			<td width="7">:</td>
			<td width="243"><? echo $hasilc['fax']; ?></td>
		</tr>
		<tr>
			<td height="19">&nbsp;</td>
		</tr>
	</table>
   </form>
</div>
<div id="divsa">
	<table id="sales" height="118" cellspacing="0" cellpadding="0" vspace="0">
		<tr>
			<td height="19">Date</td>
			<td>:</td>
			<?
				$date=date('Y-m-d');
			?>
			<td><? echo $date ?></td>
		<tr>
			<td width="100" height="19">Sales</td>
			<td width="25">:</td>
			<td width="250"><? echo $hasils['nama_sales']; ?></td>
		</tr>
		<tr>
			<td height="19">DO No.</td>
			<td>:</td>
			<td><? echo $hasil['no_do']; ?></td>
		</tr>
		<tr>
			<td height="19">PO No.</td>
			<td>:</td>
			<td><? echo $hasil['no_po']; ?></td>
		</tr>
		<tr>
			<td height="19">Delivery Date</td>
			<td>:</td>
			<td><? echo $hasil['tgl_do']; ?></td>
		</tr>
		<tr>
			<td height="19">Pay Terms</td>
			<td>:</td>
			<td><? echo $hasil['payterms']; ?> Hari</td>
		</tr>
	</table>
   </form>
</div>

<div id="clearnir"></div>
<div id="batas"></div>
<div id="divcon">
	<table id="content" border="1" bordercolordark="#000000" cellspacing="0" cellpadding="0" vspace="0">
		<tr align="center" >
			<td width="24" rowspan="3" >No</td>
			<td width="123" rowspan="3">Model</td>
			<td colspan="12">Quantity(pairs)</td>
			<td width="62" rowspan="3">Pair</td>
			<td width="64" rowspan="3">Size</td>
			<td width="68" rowspan="3">Disc %</td>
			<td width="163" rowspan="3">Rekamarks</td>
		</tr>
		<tr align="center">
			<td width="34">3</td>
			<td width="34">4</td>
			<td width="34">5</td>
			<td width="34">6</td>
			<td width="34">6E</td>
			<td width="44">6</td>
			<td width="34">7</td>
			<td width="34">8</td>
			<td width="34">9</td>
			<td width="34">10</td>
			<td width="34">11</td>
			<td width="34">12</td>
		</tr>
		<tr align="center">
			<td>36</td>
			<td>37</td>
			<td>38</td>
			<td>39</td>
			<td>40</td>
			<td>39/40</td>
			<td>41</td>
			<td>42</td>
			<td>43</td>
			<td>44</td>
			<td>45</td>
			<td>46</td>
		</tr>
		<tr>
		<? $no = 1 ?>
		<? 
			$subpenjualan = mysql_query("SELECT * FROM sub_penjualan WHERE id_penjualan = $id"); 
				while($hasilsp = mysql_fetch_array($subpenjualan)){
					$idb = $hasilsp['id_barang'];
					$barang = mysql_query("SELECT * FROM barang WHERE id_barang = $idb");
					$hasilb = mysql_fetch_array($barang); 
		?>
			<td height="22" align="center"><? echo $no++ ?></td>
			<td align="center"><? echo $hasilb['kode_barang'] ?></td>
			<td align="center">
			<? 
				if($hasilsp['qty3']==0){
				echo "-";
				}else{
				echo $hasilsp['qty3']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty4']==0){
				echo "-";
				}else{
				echo $hasilsp['qty4']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty5']==0){
				echo "-";
				}else{
				echo $hasilsp['qty5']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty639']==0){
				echo "-";
				}else{
				echo $hasilsp['qty639']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty6e']==0){
				echo "-";
				}else{
				echo $hasilsp['qty6e']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty6']==0){
				echo "-";
				}else{
				echo $hasilsp['qty6']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty7']==0){
				echo "-";
				}else{
				echo $hasilsp['qty7']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty8']==0){
				echo "-";
				}else{
				echo $hasilsp['qty8']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty9']==0){
				echo "-";
				}else{
				echo $hasilsp['qty9']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty10']==0){
				echo "-";
				}else{
				echo $hasilsp['qty10']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty11']==0){
				echo "-";
				}else{
				echo $hasilsp['qty11']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['qty12']==0){
				echo "-";
				}else{
				echo $hasilsp['qty12']; } 
			?>
			</td>
			<td align="center"><? echo $hasilsp['jumlah'] ?></td>
			<td align="center">
			<? 
				if($hasilsp['size']==0){
				echo "-";
				}else{
				echo $hasilsp['size']; } 
			?>
			</td>
			<td align="center">
			<? 
				if($hasilsp['discountp']==0){
				echo "-";
				}else{
				echo $hasilsp['discountp']; } 
			?>&nbsp;%
			</td>
			<td align="center"><? echo $hasilsp['remarks'] ?></td>
		</tr>
		<? } ?>
	</table>
   </form>
</div>
<div id="batas"></div>
<div id="divfoot">
	<table border="1" bordercolor="black" id="footer"  cellspacing="0" cellpadding="0" vspace="0">
		<tr>
			<td valign="top" align="center" width="232" style="border-bottom-style:none">Dibuat</td>
			<td valign="top" align="center" width="232" style="border-bottom-style:none">Sales</td>
			<td  align="center" width="232" style="border-bottom-style:none">Mengetahui<br />Vice Director</td>
			<td valign="top" align="center" width="232" style="border-bottom-style:none">Disetujui</td>
			<td valign="top" align="center" width="238" style="border-bottom-style:none">Mengetahui</td>
		</tr>
		<tr>
			<td valign="bottom" height="33" style="border-top-style:none;"><center><? echo $nama ?></center></td>
			<td valign="bottom" style="border-top-style:none"><center><? echo $hasils['nama_sales']; ?></center></td>
			<td valign="bottom" style="border-top-style:none">&nbsp;</td>
			<td valign="bottom" style="border-top-style:none">&nbsp;</td>
			<td valign="bottom" style="border-top-style:none">&nbsp;</td>
		</tr>
		<tr>
			<td height="15" style="padding-left:2px;"><font size="1">Date :</font></td>
			<td style="padding-left:2px;"><font size="1">Date :</font></td>
			<td style="padding-left:2px;"><font size="1">Date :</font></td>
			<td style="padding-left:2px;"><font size="1">Date :</font></td>
			<td style="padding-left:2px;"><font size="1">Date :</font></td>
		</tr>
	</table>
</div>
<div id="batas"></div>
<div id="divprnt">
	<table id="print">
		<tr>
			<td align="center"><input type="button" onclick="printpage(this.type='hidden')" value="Print"></td>
		</tr>
	</table>
</div>
</div>

</body>
</html>

Lihat semua 2 jawaban

Silahkan login untuk menjawab!
Mohon bantuan agan" sexalian saya kelusitan menyimpan nip ke dalam database,
saya ememanggil nip dari tabel 1 untuk disimpan kedalam tabel lainnya,,,

<?
require "../linkdb.php";
$link=open_connection();
?>
<!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>Input Data Driver</title>

<script language="JavaScript">
function validasi(){
  var myform = document.form1;
  if (myform['nip'].value==""){
    alert("Maaf, Data belum lengkap");
	myform['nip'].focus();
	return false;
  }
  if (myform['nama_driver'].value==""){
    alert("Maaf, Data belum lengkap");
	myform['nama_driver'].focus();
	return false;
  }
  if (myform['no_sim'].value=="0"){
    alert("Maaf, Data belum lengkap");
	myform['no_sim'].focus();
	return false;
  }
    if (myform['jenis_sim'].value=="0"){
    alert("Maaf, Data belum lengkap");
	myform['jenis_sim'].focus();
	return false;
  }
    if (myform['no_hp'].value=="0"){
    alert("Maaf, Data belum lengkap");
	myform['no_hp'].focus();
	return false;
  }
return true;
}
function cek_nama_driver (kejadian)
{
kejadian = (kejadian) ? kejadian : window.event;
var charCode = (kejadian.which) ? kejadian.which : kejadian.keyCode;
	if (charCode ==13)
		{
		document.form1.no_sim.focus();
		return false;
		}
	return true;
}
function cek_no_sim(kejadian)
{
kejadian = (kejadian) ? kejadian : window.event;
var charCode = (kejadian.which) ? kejadian.which : kejadian.keyCode;
	if (charCode ==13)
		{
		document.form1.jenis_sim.focus();
		return false;
		}
	return true;
}
function cek_jenis_sim (kejadian)
{
kejadian = (kejadian) ? kejadian : window.event;
var charCode = (kejadian.which) ? kejadian.which : kejadian.keyCode;
	if (charCode ==13)
		{
		document.form1.no_hp.focus();
		return false;
		}
	return true;
}
function cek_no_hp (kejadian)
{
kejadian = (kejadian) ? kejadian : window.event;
var charCode = (kejadian.which) ? kejadian.which : kejadian.keyCode;
	if (charCode > 31 && (charCode < 48 || charCode > 57))
	{
	return false;
	}
	if (charCode ==13)
		{
		document.form1.simpan.focus();
		return false;
		}
	return true;
}
</script>

<style type="text/css">
<!--
.style1 {font-weight: bold}
.style2 {font-weight: bold}
-->
</style>
</head>
<body onLoad="document.form1.nip.focus()">
<div align="center">

  <strong>INPUT DATA DRIVER<br />
  PT. ASIA NEGGA PRATAMA</strong><br />
</div>
<hr width="900" size="2"  color="#07CEC8"  /><strong></strong>
          <br />
<form id="form1" name="form1" method="post" action="input_driver.php" onSubmit="return validasi()">
          <table width="500" height="199" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="133"><span class="style2"><strong>NIP</strong></span></td>
              <td width="367">
            
              
              
                <?php 
                //untuk bagian ini nip tidak mau ikut tersimpan dalam database
mysql_connect("localhost","root","root"); 
mysql_select_db("offline"); 
$result = mysql_query("select * from staff"); 
$jsArray = "var stfName = new Array();\n"; 
echo '<select name="stfId" onchange="changeValue(this.value)">'; 
echo '<option>-------</option>'; 
while ($row = mysql_fetch_array($result)) { 
echo '<option value="' . $row['nip'] . '">' . $row['nip'] . '</option>'; 
$jsArray .= "stfName['" . $row['nip'] . "'] = {name:'" . addslashes($row['nama_staff']) . "'};\n"; 
} 
echo '</select>'; 
?> 
                <label></label></td>
            </tr>
            <tr>
              <td><span class="style2"><strong>Nama Driver</strong></span></td>
              <td><input name="nama_driver" type="text" class="inputbok" id="nama_driver" onKeyPress="return cek_nama_driver(event)" size="33" maxlength="30" />
			  <script type="text/javascript"> 
<?php echo $jsArray; ?> 
function changeValue(id){ 
document.getElementById('nama_driver').value = stfName[id].name; 
}; 
</script>			  </td>
            </tr>
            <tr>
              <td><span class="style2"><strong>No. SIM</strong></span></td>
              <td><label>
                <input name="no_sim" type="text" id="no_sim" size="33" maxlength="30" onKeyPress="return cek_no_sim(event)" />
              </label></td>
            </tr>
            <tr>
              <td><strong>Jenis SIM</strong></td>
              <td><label>
                <select name="jenis_sim" id="jenis_sim" onKeyPress="return cek_jenis_sim(event)">
                  <option value="B1">B1</option>
                  <option value="B2">B2</option>
                </select>
              </label></td>
            </tr>
            <tr>
              <td><strong>No. HP</strong></td>
              <td><label>
                <input name="no_hp" type="text" class="inputbok" id="no_hp" onKeyPress="return cek_no_hp(event)" size="33"/>
              </label></td>
            </tr>
            <tr>
              <td><span class="style2"></span></td>
              <td><input name="simpan" type="submit" id="simpan" value="Simpan" class="inputbok" />
                  <input name="batal" type="reset" id="batal" value="Batal" class="inputbok" /></td>
            </tr>
          </table>
<br />
          <?
if(isset($_POST['simpan'])){
	$id_driver		=$_POST['id_driver'];
	$nama_driver	=$_POST['nama_driver'];
	$nip			=$_POST['nip'];
	$no_sim     	=$_POST['no_sim'];
	$jenis_sim		=$_POST['jenis_sim'];
	$no_hp       	=$_POST['no_hp'];
	
	$query=mysql_query("insert into driver values('$id_driver','$nama_driver','$nip','$no_sim','$jenis_sim','$no_hp')",$link) or die("<div class='pesan2'style='width:550px;padding:5px;'>Data Driver dengan ID $id_driver sudah ada dalam database.</div>"); 
	if($query) {
?>
</form>
          <fieldset class="inputbok" style="width:500px;">
<legend style="color:#0099CC;"><strong>Data Driver Berhasil Disimpan</strong></legend>
<table width="500" height="142" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="133">NIP</td>
    <td width="12"><div align="center">:</div></td>
    <td width="355"><? $row['nip']; ?></td>
  </tr>
  <tr>
    <td>Nama Driver</td>
    <td><div align="center">:</div></td>
    <td><? echo $nama_driver; ?></td>
  </tr>
  <tr>
    <td>No. SIM</td>
    <td><div align="center">:</div></td>
    <td><? echo $no_sim; ?></td>
  </tr>
  <tr>
    <td>Jenis SIM</td>
    <td><div align="center">:</div></td>
    <td><? if($jenis_sim="B1"){ echo "B1"; }elseif($jeis_sim="B2"){ echo "B2"; }
 ?></td>
  </tr>
  <tr>
    <td>No. HP</td>
    <td><div align="center">:</div></td>
    <td><? echo $no_hp;
 ?></td>
  </tr>
</table>
</fieldset>
<? }}?>
</p></p>
      </div></td>
    </tr>
    <tr>
      <td bgcolor="#07CEC8"><div align="center" class="style1"></div></td>
    </tr>
</table>
</body>
</html>

Lihat semua 1 jawaban

Silahkan login untuk menjawab!

fungsi if

gilang · Mar 11, 2013
Bisa gak gan membuat tabel dengan jumlah 20 jika tabelnya lebih dari 10 maka warnanya berbeda.
contoh tabel 1-10 biru trus 10-15 merah kemudian 15-20 kuning.
bisa gak ya gan?

Lihat semua 3 jawaban

Silahkan login untuk menjawab!
Para master tolong donk ada yang tw validasi form textarea tidak yah
agar form komentar tidak bisa di inputkan link ex: www or .com gitu..
seperti itu terima kasih

salam newbie

Lihat semua 2 jawaban

Silahkan login untuk menjawab!

form input

Iwan · Mar 8, 2013
mas numpang nanya .. gmn caranya nyimpan inputan dari beberapa form menggunakan 1 button ?? bs gag mas tu ???
misal ada form soal untuk pertannyaan pertama , dibawahnya da form soal lagi untuk pertanyaan kedua ,, pada saat di tekan simpan , kedua soal tersebut tersimpan k dtabase bersamaan .. soalnya q nyoba gbsa mas ,, hanya tersimpan salah satu saja....

mhon bantuannya

Lihat semua 1 jawaban

Silahkan login untuk menjawab!

Tolongin ane donk.

gilang · Mar 8, 2013
stiap ane coba selalul salah. ada yang bisa bantu?
<?php
session_start();

$user = "root";
$pass = "";
$host = "localhost";
$db = "test";

$conn = mysql_connect($host,$user,$pass);
mysql_select_db($db);
if(!$conn){echo"Gagal Koneksi ke Database";}

if(isset($_POST)){
$_SESSION = $_POST;
}

$limitPaging = 5;

if($_SESSION != ""){
$sqlPaging = "SELECT COUNT(*) as TOTAL FROM nilai_s WHERE Nama like'%".$_SESSION."%'";
}else{
$sqlPaging = "SELECT COUNT(*) as TOTAL FROM nilai_s";
}
$resultPaging = mysql_query($sqlPaging);
$dataPaging = mysql_fetch_array($resultPaging);
$totalData = $dataPaging;
if($totalData > 0){
$totalPage = ceil($totalData/$limitPaging);
$page = $_GET;{

if($page == ""){
$offset = 0; $currentPage = 1;
}else{
$currentPage = $page; $offset = ($page-1)*$limitPaging;
}

$firstPage = 1;
$lastPage = $totalPage;
$nextPage = $currentPage+1;
$prevPage = $currentPage-1;
}
}
?>
<form action="?p=4&&page=1" method="post">
<fieldset>
<legend>Form Pencarian</legend>
<input type="text" name="kataKunci" />
<input name="search" type="submit" value="search" />
<b>Kata Kunci Anda : </b>"<?php echo $_SESSION; ?>"
</fieldset>
</form><br/><br/>
<?php
if($totalData > 0){
?>
<table align="center" width="100%">
<tr>
<th width="15%">&nbsp;</th>
<th width="15%">
<?php if($currentPage != 1){ ?>
<a href="<?php echo "?p=4&&page=$firstPage"; ?>"> &lt;&lt; Hal. Pertama </a>
<?php }?>
</th>
<th width="15%">
<?php if($currentPage != 1){ ?>
<a href="<?php echo "?p=4&&page=$prevPage"; ?>">&lt; Hal. Sebelumnya</a>
<?php }?>
</th>
<th> <?php echo"$currentPage/$totalPage " ?> </th>
<th width="15%">
<?php if($currentPage != $lastPage){ ?>
<a href="<?php echo "?p=4&&page=$nextPage"; ?>">Hal. Selanjutnya &gt;</a>
<?php }?>
</th>
<th width="15%">
<?php if($currentPage != $lastPage){ ?>
<a href="<?php echo "?p=4&&page=$lastPage"; ?>">Hal. Terakhir &gt; &gt; </a>
<?php }?>
</th>
<th width="15%">&nbsp;</th>
</tr>
</table><br/>
<?php
if($_SESSION != ""){
$sqlOrang = "SELECT * FROM nilai_s WHERE Nama LIKE '%".$_SESSION."%' LIMIT $offset,$limitPaging";
}else{
$sqlOrang = "SELECT * FROM nilai_s LIMIT $offset,$limitPaging";
}
$resultOrang = mysql_query($sqlOrang);
?>
<table class="bordered" >
<tr>
<th >No</th>
<th>Nama</th>
</tr>
<?php
$no = $offset+1;
while($dataOrang = mysql_fetch_array($resultOrang)){
echo"<tr>";
echo"<td>".$no."</td>";
echo"<td>".$dataOrang."</td>";
echo"</tr>";
$no++;
}
?>
</table>
<?php
}else{
echo"Data dengan Kata Kunci : <b>'".$_SESSION."'</b> Tidak Ditemukan !!!";
}
?>

Lihat semua 11 jawaban

Silahkan login untuk menjawab!