Vous êtes sur la page 1sur 11

Belajar Menjadi Developer

Web
Hal Awal yang Harus di Pahami?

INI AWAL!!
Mulai dari mana?
Kerja Server
Web
Sisi Seorang Programmer
sekarang
Bagaimana HTML dan PHP menjadikan website dinamis?

Menghubungkan PHP dan MySQL?


HTML 1
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title>LatihanMIT</title>
</head>

<body>

<h1>Tes Lempar Variable menggunakan GET dan POS</h1>

<h2> Post form</h2>


<form method="post" action="pos_get2.php">
text:<input type="text" size =40 name="nama_bla">
<input type=submit value="Submit Post">
</form>

<h2> GET form</h2>


<form method="get" action="pos_get2.php">
text:<input type="text" size =40 name="nama_blu">
<input type=submit value="Submit Get" >
</form>

</body>
</html>
FORM?

POST?

GET?
<html>
<head>
<meta http-equiv="content-type"
content="text/html;charset=ISO-8859-1">
<title>Latihan saja</title>
</head>
<body>
<h1>nangkep saja</h1>

<?
if($_GET['nama_blu'])
{

menangkapnya?
$name = $_GET['nama_blu'];
}
echo($name);

if($_POST['nama_bla'])
{
$name = $_POST['nama_bla'];
}

Bagaiman
echo($name);

?>
<p>
<a><input type="button" value="back"
onclick="history.go(-1)"></a>
</p>

</body>
</html>
MYSQL & PHP

$koneksi=mysql_connect("localhost","root","") or die ("gagal euy");

mysql_select_db("databuoy",$koneksi);

$kueri=mysql_query('select * from data limit 0,30');

$row=mysql_fetch_array($kueri)
Contoh <?
$koneksi=mysql_connect("localhost","root","") or die
("gagal euy");
echo "sukses";
echo "<br>";
mysql_select_db("databuoy",$koneksi);

$kueri=mysql_query('select * from data limit 0,30'); ?>


<table width="500" border="1">
<tr bgcolor="#0066FF">
<td>Nomor</td>
<td>Tanggal/Jam</td>
<td>ID BUOY</td>
<td>SUHU (Celcius)</td>
<td>ARAH ANGIN (Derajat)</td>
<td>KEC ANGIN (m/s)</td>
</tr>
<?
while($row=mysql_fetch_array($kueri)){ ?>
<tr>
<td><?php echo $row['noid']; ?></td>
<td><?php echo $row['tanggaljam']; ?></td>
<td><?php echo $row['buoy']; ?></td>
<td><?php echo $row['suhu']; ?></td>
<td><?php echo $row['arah_angin']; ?></td>
<td><?php echo $row['kec_angin']/4000 * 15; ?
></td>
</tr>
<? } ;?>
</table>
selanjutnya?