Selasa, 06 Desember 2011

Passing variabel (POST)

Passing variabel;
Passing variabel terdiri dari dua Scrpit tambahan yaitu
1. POST
2. GET


1. POST
memindahkan data inputan ke form lain contoh: email.......

 langkah-langkahnya
1. buat tabel


dengan script
.........................................................................................................
<!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>
</head>

<body>
<form>
<table width="34%" border="0" align="center">
  <tr>
    <th width="31%" scope="col">Nama</th>
    <th width="31%" scope="col"><label>
      <input name="nama" type="text" id="nama" />
    </label></th>
    </tr>
  <tr>
    <th scope="row">Alamat</th>
    <th scope="row"><label>
      <input name="alamat" type="text" id="alamat" />
    </label></th>
    </tr>
  <tr>
    <th scope="row">Umur</th>
    <th scope="row"><label>
      <input name="umur" type="text" id="umur" />
    </label></th>
    </tr>
  <tr>
    <th scope="row">&nbsp;</th>
    <th scope="row"><label>
      <input type="submit" name="Submit" value="kirim" />
    </label></th>
  </tr>
</table>
</form>
</body>
</html>


nb:
jangan lupa link ke file Proses_Post.Php
........................................................................................................
kemudian buat file ke 2 dengan nama Proses_post.Php
 ...........................................................................................
<!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>
</head>

<body>
<?php
$nama = $_POST[nama];
$alamat =$_POST[alamat];
$umur=$_POST[umur];
echo ("$nama"."<br>");
echo ("$alamat"."<br>");
echo ("$umur"."<br>");

?>
</body>
</html>
...................................................
output
pertama
kemudian masukkan input tekan kirim maka akan keluar form input database