SitePoint Sponsor

User Tag List

Results 1 to 1 of 1

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Change View From Column into Form

    Index.php
    Code PHP:
    <html>
    	<head>
    		<title>Master Desain</title>
    			<style type="text/css">
    				.style17 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; }
    				.style18 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; font-style: italic; }
    			</style>
    	<script src="js/jquery.min.js"></script>
    	<script>
    		function showHint1(str)
    		{
    			if (str.length==0)
    				{
    				document.getElementById("txtHint1").innerHTML="";
    				return;
    				}
    			if (window.XMLHttpRequest)
    				{// code for IE7+, Firefox, Chrome, Opera, Safari
    				xmlhttp=new XMLHttpRequest();
    				}
    			else
    				{// code for IE6, IE5
    				xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    				}
    			xmlhttp.onreadystatechange=function()
    			{
    			if (xmlhttp.readyState==4 && xmlhttp.status==200)
    				{
    					document.getElementById("txtHint1").innerHTML=xmlhttp.responseText;
    				}
    			}
    			xmlhttp.open("GET","getbahan.php?qa="+str,true);
    			xmlhttp.send();
    		}
    		function showHint2(str)
    		{
    			if (str.length==0)
    				{
    				document.getElementById("txtHint2").innerHTML="";
    				return;
    				}
    			if (window.XMLHttpRequest)
    				{// code for IE7+, Firefox, Chrome, Opera, Safari
    				xmlhttp=new XMLHttpRequest();
    				}
    			else
    				{// code for IE6, IE5
    				xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    				}
    			xmlhttp.onreadystatechange=function()
    			{
    			if (xmlhttp.readyState==4 && xmlhttp.status==200)
    				{
    					document.getElementById("txtHint2").innerHTML=xmlhttp.responseText;
    				}
    			}
    			xmlhttp.open("GET","getbahan.php?qb="+str,true);
    			xmlhttp.send();
    		}
    	</script>
    	</head>
    		<body>
    			<p><b>Ketikan Nama Bahan:</b></p>
    			<form>
    				Motif Bahan: <input type="text" onkeyup="showHint1(this.value)" size="20" />
    				Group Bahan: <input type="text" onkeyup="showHint2(this.value)" size="20" />
    			</form>
    			<p>Daftar Ditemukan: <span id="txtHint1"></span></br>
    			Group Ditemukan: <span id="txtHint2"></span></p>
    		</body>
    </html>

    getbahan.php
    Code PHP:
    <?php
     
    include ("db/condesain.php");
    Header("Content-type: image/jpeg"); 
    $q1=$_REQUEST["qa"];
    $q2=$_REQUEST["qb"];
    if (isset($q1) != '')
    { $sql = mysql_query(" SELECT * FROM desain WHERE xkode like '%$q1%' limit 1"); }
    else
    { $sql = mysql_query(" SELECT * FROM desain WHERE grp2 like '%$q2%' limit 1"); }
     
    // $sql="SELECT * FROM desain ";
    $result = mysql_query($sql);
    $numrows = mysql_num_rows($sql);
    header ("content-type: image/jpeg");
    echo "$q1"," Jumlah Baris :","$numrows";
    echo "<table border='1'>
    	<tr>
    		<th>Kode</th>
    		<th>Bahan</th>
    		<th>Sub.Kode</th>
    		<th>Lebar</th>
    		<th>Seri</th>
    		<th>Group</th>
    		<th>Jenis</th>
    		<th>Pcs</th>
    		<th>Stock</th>
    		<th>Satuan</th>
    		<th>Gambar</th>
    	</tr>";
     
    	while($row = mysql_fetch_array($sql))
    	{
    		echo "<tr>";
    		echo "<td>" . $row['kode'] . "</td>";
    		echo "<td>" . $row['bahan'] . "</td>";
    		echo "<td>" . $row['sgrp1'] . "</td>";
    		echo "<td align='right'>" . $row['grp1'] . "</td>";
    		echo "<td>" . $row['seri'] . "</td>";
    		echo "<td>" . $row['grp2'] . "</td>";
    		if ($row['jenis']=='1')
    		{ echo "<td align='right'>" . 'Polos' . "</td>";}
    		if ($row['jenis']=='2')
    		{ echo "<td align='right'>" . 'Printing' . "</td>";}
    		if ($row['jenis']=='3')
    		{ echo "<td align='right'>" . 'Yarn Dyed' . "</td>";}
    		echo "<td align='right'>" . number_format($row['pcs'],2,",",".") . "</td>";
    		echo "<td align='right'>" . number_format($row['stock'],2,",",".") . "</td>";
    		if ($row['satuan']=='1')
    		{ echo "<td align='right'>" . 'Yard' . "</td>";}
    		if ($row['satuan']=='2')
    		{ echo "<td align='right'>" . 'Kgs' . "</td>";}
    		if ($row['satuan']=='3')
    		{ echo "<td align='right'>" . 'Meter' . "</td>";}
     
    		echo "<td><img style='height:32px';width:32px' src=" . $image[$row['gambar']] . "/></td>";
    		echo "</tr>";
    	}
    	echo "</table>";
     
    mysql_close($con);
    ?>


    Need help to change view column into form view
    Attached Images Attached Images
    Last edited by lans41; Oct 17, 2012 at 22:01. Reason: Insert Picture


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •