bahasa program php

Mengedit tampilan select

good day, brother and sister
pada kesempatan kali ini saya akan menyajikan tulisan mengenai mengedit tampilan perintah select.

berikut ini contoh penulisanya:
editprofila3.php

<html>
<head><title>Membuat profile </title></head>
<body>
<table width="490px"cellpadding="4px"bgcolor="blue"border="0px"align="left"><tr><td><font style="color:#efecff;font-size:24px;">okebos</font></td></tr></table><br/>
<?php
$id1=$_GET["id"];
$baris2=mysqli_query("SELECT * FROM tblprofila WHERE id='$id1'");
$dataku=mysqli_fetch_array($baris2);
$usernama=$dataku["usernama"];
$nama=$dataku["nama"];
$kelamin=$dataku["kelamin"];
$lahir=$dataku["lahir"];
$sekolah=$dataku["sekolah"];
$kerja=$dataku["kerja"];
$alamat=$dataku["alamat"];

?>
<table width="490px"cellpadding="4px"border="1px"align="left">
<tr><td><table><tr><td width="60px"height="60px"></td></tr></table><b>profile saya</b></td></tr>
<tr><form method="POST"action="editprofila3.php"><td width="160px">1.usernama</td><td width="6px">:</td><td width="324px"><input type="text"name="usernama"value="<?php echo $usernama;?>"></td></tr>
<tr><td width="160px">2.nama</td>
<td style="width:6px;">:</td><td width="324px"><input type="text"name="nama"value="<?php echo $nama;?>"></td></tr>
<tr><td width="160px">3.Jenis kelamin</td><td width="6px">:</td><td width="324px"><?php echo $kelamin;?></td></tr>
<tr><td width="160px">4.tempat tgl.lahir</td><td width="6px">:</td><td width="324px"><input type="text"name="lahir"value="<?php echo $lahir;?>"></td></tr>
<tr><td width="160px">5.pendidikan akhir</td><td width="6px">:</td><td width="324px"><input type="text"name="sekolah"value="<?php echo $sekolah;?>"></td></tr>
<tr><td width="160px">6.pekerjaan akhir</td><td width="6px">:</td><td width="324px"><input type="text"name="kerja"value="<?php echo $kerja;?>"></td></tr>
<tr><td width="160px">7.alamat tinggal</td><td width="6px">:</td><td width="324px"><input type="text"name="alamat"value="<?php echo $alamat;?>"></td></tr></table>
<table width="490px"cellpadding="4px"bgcolor="blue"><tr><td align="center"><input type="submit"value="sunting"></td></form></tr></table>

<?php
$usernama=$_POST["usernama"];
$nama=$_POST["nama"];
$kelamin=$_POST["kelamin"];
$lahir=$_POST["lahir"];
$sekolah=$_POST["sekolah"];
$kerja=$_POST["kerja"];
$alamat=$_POST["alamat"];

$baris2=mysqli_query("UPDATE tblprofila SET usernama='$usernama',nama='$nama',kelamin='$kelamin',lahir='$lahir',sekolah='$sekolah',kerja='$kerja',alamat='$alamat' WHERE id='$id1'");
if($baris2){
echo "<font style='color:red;'>gagal mengedit</font>";
}else{
echo "<font style='color:green;'>berhasil mengedit</font>";
}
?>

</body>
</html>
dan berikut contoh gambarnya:

image

Dengan demikian selesai sudah pembahasan mengenai perintah edit dalam mysql query dan php semoga dapat dipahami.

Advertisements
Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s