Bentuk Tampilan table

Juragan · Dec 10, 2012
Saya memiliki tabel PHP yang isi nilai nya diambil dari didalam database,
isi database tabel sebagai berikut

Tahun|jan|feb|mar|apr|
2001| 1|1|1|1
2002| 1|1|1|1
2003| 1|1|0|1
2004| 1|1|1|0
2005| 1|1|1|0
2006| 1|1|1|1

lalu bagaimana agar tampil dalam PHP dengan tabel
seperti berikut agar terlihat singkat

Tahun|jan|feb|mar|apr|
2001-2002| 1|1|1|1
2003 | 1|1|0|1
2004-2005| 1|1|1|0
2006 | 1|1|1|1

Lihat semua 5 jawaban

Silahkan login untuk menjawab!

insert

Robert James M · Dec 10, 2012
mas aku buat form seperti ini
<form class="block-content form" name="form_account_edit" id="form_account_edit" method="post" enctype="multipart/form-data" action="http:haya.php" onsubmit="return IQ.checkForm(this,'checkPasswordAndPicture(document.form_account_edit);');">
   
    <div class="columns">
        <div class="colx2-left">
            
               

                <table cellpadding="3" class="table-padding">
                
            
                
                
                
                    <tr title="Required">
                        <td><b>Produk</b><span class="required">*</span></td>
                        <td>:</td>
                        <td><select name="produk" id="cbproduk" style="width:212px"></select></td> 
					</tr>
                    <tr>
                        <td><b>Unit</b></td>
                        <td>:</td>
                        <td><select name="unit" id="cbunit_mk" style="width:212px"></select></td>
                    </tr>                        
                                   
                </table>
               
        </div>
    </div>
    <div class="block-footer" style="height:30px;">
        &nbsp;
        <div class="float-right">
            <button type="submit"><img src="images/icons/fugue/tick-octagon.png" width="16" height="16"> Save</button>
        </div>
    </div>
</form>

itukan combobox dengan javascript kemudian aku insert dengan kode seperti ini
<?php

  mysql_connect("localhost", "root", "");
  mysql_select_db("combo");
  

  $produk     		= htmlspecialchars($_POST['produk']);
  $unit				= htmlspecialchars($_POST['unit']);

 

  $sql            = "INSERT INTO air VALUES ('$produk','$unit')";


	
  mysql_query($sql) or die ('Failed');
             
  echo  "<h1>Register Success</h1>";
  echo  "<br>";
  
 
 
  
?>      

tapi ko kebacanya angka, bukan textnya misalkan air

terima kasih

Lihat semua 8 jawaban

Silahkan login untuk menjawab!
misal saya punya folder upload, isinya penting.jpg

kalo admin bisa akses url localhost/upload dan localhost/upload/penting.jpg
kalo user biasa ga bisa akses localhost/upload dan localhost/upload/penting.jpg
gimana ya mas?

Lihat semua 1 jawaban

Silahkan login untuk menjawab!
index
    <html lang="en">
    <head>
    <meta charset="utf-8" />
    <!-- sesuaikan dengan path jqueryui yang kamu punya -->
    <link rel="stylesheet" href="jquery-ui-1.9.2.custom/themes/black-tie/jquery-ui.css" />
    <script src="jquery-ui-1.9.2.custom/js/jquery-1.8.3.js"></script>
    <script src="jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.js"></script>
    </head>
    <body>
    <form action="" method="post">
    Nama: <input type="text" name="nama[0]" id="nama"/>
    Kelas: <input type="text" name="kelas" id="kelas"/>
    </br>
    Nama: <input type="text" name="nama[1]" id="nama"/>
    Kelas: <input type="text" name="kelas" id="kelas"/>
    </br>
    Nama: <input type="text" name="nama[2]" id="nama"/>
    Kelas: <input type="text" name="kelas" id="kelas"/>
    </form>
    <script>
	
    $(function() {
		

    $( "#nama" ).autocomplete({
    source: "get_nama.php",
    minLength: 2,
    select: function( event, ui ) {
    $('#nama').val(ui.item.nama);
    $('#kelas').val(ui.item.kelas);
	}
    });
    });
	
    </script>
    </body>
    </html>
get_nama
<? include ('koneksi.php'); 
    $kode = $_GET['term'];
    $sql = "select * from foto where nama like '$kode%'";
    $hs = mysql_query($sql);
    $json = array();
	
    while($rs = mysql_fetch_array($hs)){
    $json[] = array(
    'label' => $rs['nama'],
    'value' => $rs['nama'],
    'kelas' => $rs['kelas']

    );
    }
    header("Content-Type: application/json");
    echo json_encode($json);
	?>  

butuh pencerahan master
gmn biar nama di baris ke 2 n 3
bisa tampil js autocomplete jg seperti di baris 1

Lihat semua 5 jawaban

Silahkan login untuk menjawab!
Permisi para suhu2 PHP..
Mau nyari pencerahan nih..
Saya sudah melakukan pagination dalam tabel search saya..
Tapi kenapa pada saat saya tekan tombol next, data berikutnya kosong..
Padahal masih ada 1 page lagi..

Saya sertakan potongan scriptnya..
$dataPerPage= 20 ;

if(isset($_GET['page'])){
	$noPage = $_GET['page'];}
else
	$noPage = 1;

$offset=($noPage - 1)* $dataPerPage;
$where = '';
If(isset($_POST['search'])){

	$tgl_awal= $_POST['tgl_awal'];
	$tgl_akhir= $_POST['tgl_akhir'];
		
	$sort = $_POST['ord'];
	
	$nama = $_POST['keyw'];
	
	$where .= " WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' AND nama LIKE '%$nama%' ORDER BY log_absen $sort LIMIT $offset, $dataPerPage";
	
	$query = "SELECT * FROM absen" .$where;
	
	$result = mysql_query($query) or die(mysql_error());}
elseif (isset($_POST['searchall'])){
	$query = "SELECT * FROM absen ORDER BY log_absen DESC LIMIT $offset, $dataPerPage";
	$result = mysql_query($query) or die(mysql_error());}
else {
	$where .= " WHERE tanggal = CURDATE() ORDER BY log_absen DESC  LIMIT $offset, $dataPerPage";
	$query = "SELECT * FROM absen" .$where;
	$result = mysql_query($query) or die(mysql_error());}
	
	

/*$isiabsen= mysql_query("SELECT * FROM absen ORDER BY log_absen DESC");*/

echo "<h1>Hasil pencarian</h1>";
echo "<table align='center' border='1' cellpadding='5' cellspacing='0' align='center'>
	<tr>";
		echo "<th><font size='2' face='Arial'>Log</font></th>";
		echo "<th><font size='2' face='Arial'>Name</font></th>";
		echo "<th><font size='2' face='Arial'>Location</font></th>";
        echo "<th><font size='2' face='Arial'>Date</font></th>";
		echo "<th><font size='2' face='Arial'>Time</font></th>";
	echo "</tr>";
while($row1= mysql_fetch_array($result))
	{
	
	echo "<tr>";
		echo "<td><font size='2' face='Arial'>" . $row1['log_absen'] . "</font></td>";
		echo "<td><font size='2' face='Arial'>" . $row1['nama'] . "</font></td>";
		echo "<td><font size='2' face='Arial'>" . $row1['lokasi'] . "</font></td>";
		echo "<td><font size='2' face='Arial'>" . $row1['tanggal'] . "</font></td>";
		echo "<td><font size='2' face='Arial'>" . $row1['waktu'] . "</font></td>";
		echo "</tr>";}
	echo "</table>";

$qp="SELECT Count(*)AS jumData FROM absen" .$where;
$hasil= mysql_query($qp);
$data = mysql_fetch_array($hasil);

$jumData = $data['jumData'];

$jumPage = ceil($jumData/$dataPerPage);

if($noPage>1) 
	echo "<font align='center' size='2' face='Arial'><a href='".$_SERVER['PHP_SELF']."?page=".($noPage-1)."'>&lt;&lt; Prev</a></font>";

for($page = 1; $page <=$jumPage; $page++){
	if((($page>=$noPage - 3) && ($page <= $noPage + 3)) || ($page == 1) || ($page == $jumPage)){
		$showPage = $page;
		if(($showPage == 1) && ($page !=2)) echo " ";
		if(($showPage !=($jumPage - 1))&&($page==$jumPage)) echo " ";
		if ($page == $noPage) echo"<font align='center' size='2' face='Arial'>".$page."</font>";
			else echo"<font align='center' size='2' face='Arial'><a href='".$_SERVER['PHP_SELF']."?page=".$page."'>".$page."</a></font>";
		$showPage = $page;
	}
}
if ($noPage < $jumPage){
	echo "<font size='2' face='Arial'><a href='".$_SERVER['PHP_SELF']."?page=".($noPage+1)."'> Next &gt;&gt;</a></font>";}
?>

Mohon pencerahannya..
Terima kasih..

Lihat semua 5 jawaban

Silahkan login untuk menjawab!
ko mo tny, gmn cara menambah file attachment pada mailer autoresponder
 form1
 <form id="affiliate_create_form" method="post" action="pro1.php" style="margin:0;padding:0;" >
    <div class="title">
	<div class="text">
	    
	</div>
    </div>

    
				
    <div class="description">
	<div class="text">
	   
	</div>
    </div>

    <table class="basic_form" align="center">
	<tr class="important">
	    <td class="required">Full Name</td>
	    <td><input name="name" type="text" style="width:240px;" value=""></td>
	</tr>
																						
	<tr>
	  <td class="required">Email Address</td>
	  <td><input type="text" name="email" value=""></td>
	  </tr>
		
	<tr>
	  <td></td>
	  <td><button type="submit">Continue</button></td>
	  </tr>

    </table>

    <script>
	//document.getElementById('country').value = "";
    </script>

</form>
<?php
 include("affiliates/connect.inc.php");

 
 $regUsid = md5(uniqid(rand()));
 $regUser = $_POST['name'];
 $regMail = $_POST['email'];
 //sample
	$fileatt = $_FILES['fileatt']['tmp_name'];
	$fileatt_type = $_FILES['fileatt']['type'];
	$fileatt_name = $_FILES['fileatt']['name'];
 //end of sample
 $qUser = mysql_query("SELECT * FROM user_subcribe WHERE Name='$regUser'");
 $qMail = mysql_query("SELECT * FROM user_sub WHERE email='$regMail'");

 $nUser = mysql_num_rows($qUser);
 $nMail = mysql_num_rows($qMail);
 
 if($nUser == 0 && $nMail == 0){
  $tujuan = $regMail;
  $subjek = "Thanks for Comfirming your details- www.healthonlinegroup.com";
  $data_s = "From: support@healthonlinegroup.com"."Reply-To: support@healthonlinegroup.com";
  $isi    = "Thank you for your order and confirming your details  \r\n";
  $isi   .= "Attached to this email you will find your guide for yo to read or print straigh away \n";
  $isi   .= "You will also attached your bonouses\r\n";
  $isi   .= "If you have any problems or questions, please do not hesitate to email me at support@healthonlinegroup.com \r\n";
  $isi   .= "Good luck  with your Conception  and we look foward to hearing your succes  story!\r\n";
  $isi   .= "thanks\r\n";
  $isi   .= "Sarah Jefries\r\n";
  $isi   .= "Customer Service Manager\r\n";
  $isi   .="<a href='e-book/Symfony_cmf_master.pdf'><img  src='e-book/images.jpg' alt='pdf' />e-book1</a>\r\n";
  $isi   .="<a href='e-book/Symfony_cmf_master.pdf'><img  src='e-book/images.jpg' alt='pdf' />e-book1</a>\r\n";
  $isi   .="<a href='e-book/Symfony_cmf_master.pdf'><img  src='e-book/images.jpg' alt='pdf' />e-book1</a>\r\n";
  $atc.='AddAttachment "c:\mydocuments\test.txt"';
  mail($tujuan, $subjek, $isi, $data_s,  $atc);
  
  mysql_query("INSERT INTO user_subcribe(Name, Id) VALUES('$regUser', '$regUsid')");
  mysql_query("INSERT INTO user_sub(Id, email,status) VALUES('$regUsid','$regMail','n')");
  
  echo"<script language='javascript'>window.location='after_thankyou1.html'</script>";
 }
 elseif($nUser>0){
  echo"<script language='javascript'>alert('Username already exist, please pick another username !')</script>";
  echo"<script language='javascript'>window.location='thankyou_confirm4.htm'</script>";
 }
 elseif($nMail>0){
  echo"<script language='javascript'>alert('eMail address already exist, please use another eMail address, or you can contact us if you forgotten your password !')</script>";
  echo"<script language='javascript'>window.location='thankyou_confirm4.htm'</script>";
 }
 else{
  echo"<script language='javascript'>alert('Several error occured !')</script>";
  echo"<script language='javascript'>window.location='thankyou_confirm.htm'</script>";
 }
?>

$isi .="<a href='e-book/Symfony_cmf_master.pdf'><img src='e-book/images.jpg' alt='pdf' />e-book1</a>\r\n"; file ini yang akan di jadikan attachment

thx

Lihat semua 1 jawaban

Silahkan login untuk menjawab!