Awal Penciptaan Java

Benarkah asal nama bahasa pemrograman JAVA berasal dari pulau jawa??Cari tahu kebenaranya!!.

Apa itu PHP?

Bagaimana awal pembuatan PHP?Apa fungsinya?dan Apa keunggulan PHP dari bahasa pemrogrman yang lain?

Sikap yang Baik/Positive

Banyak Hal Yang Bisa Dihasilkan oleh Sikap yang Baik

Sabtu, 25 Januari 2014

Mozilla Class on Wikufest



Hay Rwekkk :D
This is the first article in 2014 even 2013 hehehe.

The Class

I would like to tell you about the most excited class in Wikufest 2014,that’s the Mozilla class.I just want to tell you all about Mozilla class,sooo if you wondered what wikufest is?just read the entire article,The explanation about Wikufest is on the bottom of this article.OK Let’s Start .. 





2014,Wikufest,Mozilla…Awww let me scream first haha :D
This year is the second time Mozilla come to my school(SMK TELKOM SANDHY PUTRA MALANG,just in case if you kepo where am I studying :P).I always excited,on fire,and excited again when Mozilla come to my school,they come to my school  for Wikufest 2014.I’ve been a Mozilla’s huge fan since grade X :D
Firefox OS class is the one and only Mozilla class that I joined this year.I forget the class name but I will tell all about the Mozilla class that I joined.In this class we have mas Arief as our mentor and He will explain “How to start building an application for Firefox OS”.It start with all requirement and all stuff(include add on,firefox Os simulator fot Mozilla Firefox,etc) that we need to start build an application for Firefox OS.
I thought that building app in Firefox OS platform is more like building app on android but I was wrong because it’s “just like that”.What I mean with “just like that” is we don’t have to install many things like when we try to build app on android,we just need to build an responsive  web application  then that’s it we could try our app on a Firefox OS simulator.We just need to learn how to make a responsive website then our responsive website could be an Firefox OS app.All we need is an manifest.webapp,an app.html and some folder to save css,js,and image.App.html is where you put all your code for your application,Mas Arif said that most of the Firefox OS developer just using CSS,HTML5,and JS to build an app.Yaaa…so that’s what I call with “just like that” :D.There’s so many idea going trough my mind,Since I know that build Firefox OS app it’s “Just Like That” hahaha just wait for my app.
Beside “just like that”,Mas Arief also show us some of simple apps that he made or somebody else made.He also tell us about css framework like bootstrap but I forget the name hehe,I just remember that we could download it from buildingfirefoxos.com CMIIW :P.After he told us all about how to start build app on Firefox OS then He gave us a challenge for final hour,he challenge us to build the simple app and the best 5 will get  5 prizes which is 4 t-shirt and 1 laptopcase.3 of the t-shirt is Mozilla T-Shirt,which I really wanted :P.So I doing it for 1 hour and my app is done,it’s a…………photo gallery app hahahahaha,really really simple photo gallery.Then I go to mas Arief to show my app,I was the first people that show our work to mas Arif :D.All my friends are just followers  -_-,they don’t want to go first.
And the result is….I …..just got double sticker -_-.It’s Ok,what important the most is that I got very very interesting and useful knowledge so I could build an app in Firefox OS platform

Just for your Information,Mas Arief is very handsome and kind man :D.He always help and answer our problem and question on this class.So if you want to know more about mas Arief follow him on Twitter @ariefbayu.


Mas Arief helping Didit





That was the second year or 2014,now I will tell you all about Mozilla class on the first year.
First year,first time,More Loud Screaming :D
When I first know that Mozilla will come to my school,I was like “No way,they would come to our school guys”.I couldn’t believe it haha but when my teacher officially told us that they really come to our school I was just like “OH My Gosh,I’ve been waiting for this time to come” hahahaha.If you think that I’am “Alay” it’s ok,cause it’s just Right :D
My first Mozilla class is How to contribute to Mozilla,and our speaker in this class is mbak Rara.
It start with an illustration video that explain about the open web.Then this is how it all started hehehe.
Mbak Rara explain about what Mozilla really is,What is firefox is,etc which is already know cause as you know I’ve been a huge fan of Mozilla since grade X and the first year is when I’m on grade XI.
Then mbak Rara ask us whose got firefox browser installed on their phone,my friend come forward and he got an official Mozilla T-Shirt -_-,just like that again.I talk with my own mind that I should got that tshirt tomorrow.

Yeahh!!! and tomorrow was come.Finally I got that t-shirt even though it’s really oversized -_-,I’m using Medium but I got XL size.I got that from the Mozilla second class that I joined. Our Speaker is Mas Benny.This class is about how to join Mozilla WebForward or WebFWD.I got the t-shirt cause I able to answer question from Mas Benny.
About WebFWD,WebFWD is  like the support or help from Mozilla to the Start Up company.All I remember is that WebFWD are not depend on the distance ,mentoring/coaching could going everywhere and anywhere and the participant could be anyone who have amazing and briliant innovation.It's take 3 month of coaching.

Yahhh and that’s all about Mozilla class on wikufest.
I hope someday I could be one of Mozilla Reps too :D


MozReps,"Some of the nicest people you will meet"

Little bit about wikufest:
It’s a annual event where some of successful alumni from my school give their experience or even tips.
@wikufest #wikufest3 #Mozilla

Selasa, 11 September 2012

PHP: Konversi Bilangan Desimal

MEMBUAT SENDIRI KALKULATOR KONVERSI DESIMAL

Kali ini saya akan memberikan tutorial tentang bagaimana membuat kalkulator konversi sederhana dengan PHP.Kita dapat mengkonversi desimal ke bilangan oktak,hexa dan biner dalam kalkulator buatan kita ini.
Langsung saja ,langkah langkahnya dibawah ini:

1.buatlah file dengan nama back.php.Nama file tersebut  bisa dirubah atau disesuaikan.

<?php
if (isset($_POST['submit'])){
    $nama=$_REQUEST['nama'];
    if(isset($_POST['gender'])){
        $gender=$_REQUEST['gender'];
    }
    else{
        $gender='';
    }
    $cek='';
}
else{
    $nama='';
    $gender='';
    $cek="you have to fill the field completely";
    }
?>
<!DOCTYPE html>

<html>
    <head>
   
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Conditional</title>
    </head>
    <style type="text/css">
a:link{color:#FF0000}
a:visited{color:#660099}
a:hover{color:#FFFF00}
a:active{color:#000000}
</style>
</head><body background="background.png">
    <script language="JavaScript">
<!--
window.alert("Welcome");
//-->
</script>
          <h1><?echo $cek?></h1><br>
        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form1">
            <p>Name : <input type="text" name="nama" value="<?php echo $nama?>"/></p>
            <p>sex : <input type="radio" name="gender" value="L"
                      <?php ($gender=="L")? print 'checked=""': print '';?>/>
        Male
        <input type="radio" name="gender" value="P"
              <?php ($gender=="P")? print 'checked=""': print ''; ?>/>
        Female </p>
            <input type="submit" name="submit" value="submit"/>
        </form>
                 <?php
        if (isset($_POST['submit'])) { // apakah data ter-sumbit?
            /*membuat variabel untuk menyimpan data yang dikirim*/
            $nama=$_REQUEST['nama'];
            if(isset($_POST['gender'])){
                $gender=$_REQUEST['gender'];
            }
            else{
                $gender='';
            }
            //cek apakah data yang dikirim tidak kososng
        if($nama==''  || $gender==''){
            echo'<h2>You are not fill the field completely </h2>';
        } else {
            /*cek jenis kelamin*/
            if ($gender=='L'){
                echo '<h2>Welcome Bro,  '.$nama.'!!</h2>';
            } else{
                echo'<h2>Welcome Sis,   '.$nama.'!!</h2>';
            }
        }
        echo "<a href='validation.php'> Click to start convertion </a>"; // HASIL ,
            }
        ?>
    </body>
</html>

script diatas akan menghasilkan form seperti ini:

bila telah berjalan seperti diatas maka kita akan menuju langkah ke2.

2.buat file php dengan nama validation.php lalu ketikan script seperti dibawah ini:

<?php
error_reporting(0);
$des = $_REQUEST['des'];//deklarasi var desimal
$option = $_REQUEST['option'];//deklarasi var pilihan
  function oct($des){      
   echo("jadi octal dari".$des." adalah ".decoct($des) . "<br />");
   
    }
function hexa($bil){
$decimal=$bil;
$ori=$decimal ;
    $hex =dechex($decimal);
    $result = strrev($hex);
      return "Bilangan $ori (desimal) dalam bentuk hexadesimal adalah $result";
 
}

function bin($bil){
      $decimal= $bil;
      $ori=$decimal;
                $binary= decbin($decimal);
                $result = strrev($binary);
      return "Biner dari : $ori adalah : $result <br/>"; //funngsi ini mereturn hasil
    }

?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
      <style type="text/css">

a:link{color:#FF0000}
a:visited{color:#660099}
a:hover{color:#FFFF00}
a:active{color:#000000}
</style>
 
    <body >
                <form action="<?php echo $_SERVER['PHP_SELF']; ?>"
                method="post" name="form1" id="style">
            <p>Inputkan : <input type="text" name="des" value="<?php echo $des ?>" /></p>
            <p>Pilih konversi : <br/>
                <input type="radio" name="option" value="bin"
                    <?php ($option=="bin") ? print 'checked=""': print ''; ?>/>
                        Desimal ke Biner<br/>
                <input type="radio" name="option" value="hex"
                    <?php ($option=="hex") ? print 'checked=""': print ''; ?>/>
                        Desimal ke Hexa<br/>
                <input type="radio" name="option" value="oct"
                    <?php ($option=="oct") ? print 'checked=""': print ''; ?>/>
                        Desimal ke Octal<br/>
            </p>
            <input type="submit" name="submit" value="Submit"/>
        </form>
        <?php
            if(isset($_POST['des'])){ //apakah data tersubmit?
                /*mambuat variable untuk menyimpan data yang dikirim*/
                $des = $_REQUEST['des'];
                $option = $_REQUEST['option'];
                //cek apakah data yang dikirim tidak kosong ?
                if($des=='' || $option==''){
                    echo '<h2>Sorry data not complete</h2><br>';
                    echo "<a href='".$_SERVER['PHP_SELF']."'>Reset</a>";
                }
                else{
                    //cek jenis kelamin
                    switch($option){
                        case 'bin' : echo "<h3>".bin($des)."</h3>"; break;
                        case 'hex' : echo "<h3>".hexa($des)."</h3>"; break;
                        case 'oct' : echo "<h3>".oct($des)."</h3>"; break;
                        default : break;
             
                  }
                }
             
              }echo "<br><a href='back.php'>back to the login page </a>";
         ?>
    </body>
</html>



bila berjalan dengan baik maka hasil akhirnya akan seperti gambar dibawah ini:


ini akan muncul saat pertama kali kita menjalankan program dan alert tersebut terbuat dari javacript





gambar dibawah akan terjadi ketika kita belum lengakp mengisi form







dan gambar dibawah akan terjadi apabila kita telah mengisi dengan lengkap data/form tersebut










hasil konversi






JAVA: Menu Menggunakan

 Membuat menu JOption dalam JAVA

Dalam tutorial ini kita akan membuat JOption dan beberapa konversi.
Juga ada program yang akan mengeja bilangan/huruf.
Langsung saja kita berlari ke script bila ada pertanyaan tinggal ditanyakan.


package Praktek1;


import javax.swing.JOptionPane;


public class MenuDariJOption {

  //Fields
    private static String sc;
    private static String _name;
    private static String _des;
    private static String _gender;
    private static int _validDes;
  //~Fields

  //Constructor
    //Class constructor here
  //~Constructor

  //Methods
    public static void hasilPecahan() {
        int desimal;

        String str = JOptionPane.showInputDialog("Masukkan bilangan yang akan dipecah : ");
        try {
            if (str.isEmpty()) {
                JOptionPane.showMessageDialog(null, "Isikan bilangannya");
                hasilPecahan();
            } else {

                desimal = Integer.parseInt(str);

                int satu, dua, tiga, empat, lima, enam, tujuh, delapan, sembilan, sepuluh, sebelas, duabelas, tigabelas;
                satu = desimal / 100000;
                desimal %= 100000;

                dua = desimal / 50000;
                desimal %= 50000;

                tiga = desimal / 20000;
                desimal %= 20000;

                empat = desimal / 10000;
                desimal %= 10000;

                lima = desimal / 5000;
                desimal %= 5000;

                enam = desimal / 2000;
                desimal %= 2000;

                tujuh = desimal / 1000;
                desimal %= 1000;

                delapan = desimal / 500;
                desimal %= 500;

                sembilan = desimal / 200;
                desimal %= 200;

                sepuluh = desimal / 100;
                desimal %= 100;

                sebelas = desimal / 50;
                desimal %= 50;

                duabelas = desimal / 10;
                desimal %= 10;

                tigabelas = desimal / 1;
                desimal %= 1;


                JOptionPane.showMessageDialog(null, "Jumlah seratus ribuan = " + satu
                        + "\nJumlah lima puluh ribuan = " + dua
                        + "\nJumlah dua puluh ribuan = " + tiga
                        + "\nJumlah sepuluh ribuan = " + empat
                        + "\nJumlah lima ribuan = " + lima
                        + "\nJumlah dua ribuan = " + enam
                        + "\nJumlah seribuan = " + tujuh
                        + "\nJumlah lima ratusan = " + delapan
                        + "\nJumlah dua ratusan = " + sembilan
                        + "\nJumlah seratusan = " + sepuluh
                        + "\nJumlah lima puluhan = " + sebelas
                        + "\nJumlah lima satuan = " + duabelas
                        + "\nJumlah satuan = " + tigabelas, "PECAHAN", JOptionPane.INFORMATION_MESSAGE);
            }
            menuJOption();
        } catch (NullPointerException not) {
            JOptionPane.showMessageDialog(null, "Bilangan Wajib Di isi!!");
            hasilPecahan();
        } catch (NumberFormatException nae) {
            JOptionPane.showMessageDialog(null, "Hey '" + str + "'"
                    + " .... bukan angka !!"
                    + "\nMasukkan angka saja !!");
            hasilPecahan();
        }
    }
    String [] angka ={"","satu","dua","tiga","empat","lima","enam","tujuh","delapan","sembilan","sepuluh","sebelas"};
    public static void outTerbilang(){
    sc = JOptionPane.showInputDialog("Inputkan Bilangan yang kamu ingin ketahui penulisannya *maksimal Quadriliyun* ");
    JOptionPane.showMessageDialog(null, new MenuDariJOption().terbilang(new Long(sc)), "TERBILANG", JOptionPane.INFORMATION_MESSAGE);
    }
    private String terbilang(long  x){
        int y;
        String bilang="";
        String[] satuan={""," Ribu "," Juta "," Milyar "," Trilyun "," Quadrilyun "};
        if(x > Math.pow(10, 20)) return "Melebihi kapasitas";
        for(int i=6;i>0;i--){
            y =  (int) (x/Math.pow(10, i*3));
            if(y > 0){
                if(y==1 && i==1) bilang += " Seribu "; else bilang += sebut(y) + satuan[i];
            } x %= Math.pow(10, i*3);
        }
        bilang+=sebut((int)x);
        return bilang;
    }
    private String sebut(int x){
        String bilang="";
        int y = x / 100;
        if(y > 0){
            bilang = angka[y]+" Ratus ";
            if(y == 1)bilang="Seratus ";
            x%=100;
        }
        if(x<12)bilang += angka[x];
        else{
            y=x/10;
            x%=10;
            if(y==1)
                bilang +=angka[x] + " Belas";
            else
                bilang += angka[y]+ " Puluh "+ angka[x];
        }
        return bilang;
    }
    public static String Bilangkan(int number){
      String result = "";
      String angka = Integer.toString(number);
      String[] bilangan = {
        "",
        "SATU",
        "DUA",
        "TIGA",
        "EMPAT",
        "LIMA",
        "ENAM",
        "TUJUH",
        "DELAPAN",
        "SEMBILAN",
        ""
      };
      int x=0;
      int a=0;
      int previous=0;
     
      for(int i=0;i<angka.length();i++){
       
        String suffix="";
        String prefix="";       
       
        int n = Integer.parseInt(Character.toString(angka.charAt(i)));       
       
        x = angka.length()-i-1;
               
       
        switch(x){
          case 0:
            if(previous == 1&&n!=0){             
              suffix="BELAS";
              if(n==1){
                prefix="SE";
                n=10;
              }
            }else{
              suffix="";
              prefix="";             
            }
            result += " "  + prefix +  bilangan[n] + suffix;
            break;
          case 1:           
            if(n!=1){
              prefix="";
              suffix="PULUH";
              if(previous!=0&&n==0){
                suffix="";
              }
            }else{
              int next = Integer.parseInt(Character.toString(angka.charAt(i+1)));
              if(next==0){
              prefix="SE";
              suffix="PULUH";             
              }
              n=10;
            }           
            result += " "  + prefix +  bilangan[n] + suffix;
            break;
          case 2:
            if(n!=1){
              prefix="";
              suffix="RATUS";
              if(previous!=0&&n==0){
                suffix="";
              }
            }else{                           
              prefix="SE";
              suffix="RATUS";                           
              n=10;
            }           
            result += " "  + prefix +  bilangan[n] + suffix;
            break;
          case 3:
            if(previous == 1&&n!=0){             
              suffix="BELAS";
              if(n==1){
                prefix="SE";
                n=10;
              }
            }else{
              suffix="";
              prefix="";             
            }
            result += " "  + prefix +  bilangan[n] + suffix;
           
            if(n!=1){
              prefix="";
              suffix="RIBU";
              if(previous!=0&&n==0){
                suffix="";
              }
            }else{                           
              prefix="SE";
              suffix="RIBU";                           
              n=10;
            }           
            result += " "  + prefix +  bilangan[n] + suffix;
            break;         
        }
        previous = Integer.parseInt(Character.toString(angka.charAt(i)));
        a++;
      }
     
      return result;
    }
   
    public static String ConvertAP(int number,int base){
      String nBase ="";     
      do{
        int mod = number%base;
        number/=base;
        if(mod < 10){
          nBase += mod;
        }else{
          nBase += (char)(mod-10+'A');
        }       
      }while(number >= 1);
     
      String fBase = "";
      for(int i=nBase.length()-1;i>=0;i--){
        fBase+=nBase.charAt(i);
      }
      return fBase;
    }
   
   
    public static void keBiner(int n){
      if(n>1){
        keBiner(n/2);
      }
      System.out.print(n%2);
    }
    public static void inputDesJOption(){
      _des = JOptionPane.showInputDialog("Masukkan Bil.Desimal = ");
    }
    public static void eksepsiInpBiner(){
      inputDesJOption();
      try{
        _validDes = Integer.parseInt(_des);
        String decBin = ConvertAP(_validDes, 2);
        JOptionPane.showMessageDialog(null, _validDes + " dalam binary adalah " + decBin);
      }catch(NumberFormatException ex){
        if(_des == null){
          JOptionPane.showMessageDialog(null, "Tolong Masukkan angka saja");
        }else{
          if(_des.isEmpty()){
            JOptionPane.showMessageDialog(null, "Inputtan anda kosong");
          }else{
            JOptionPane.showMessageDialog(null, _des + " bukan angka!\r\nMasukkan angka saja");
          }
        }
        eksepsiInpBiner();
      }
    }
    public static void eksepsiInpOctal(){
      inputDesJOption();
      try{
        _validDes = Integer.parseInt(_des);
        String decBin = ConvertAP(_validDes, 8);
        JOptionPane.showMessageDialog(null, _validDes + " dalam octal adalah " + decBin);
      }catch(NumberFormatException ex){
        if(_des == null){
          JOptionPane.showMessageDialog(null, "Tolong Masukkan angka saja");
        }else{
          if(_des.isEmpty()){
            JOptionPane.showMessageDialog(null, "Inputtan anda kosong");
          }else{
            JOptionPane.showMessageDialog(null, _des + " bukan angka!\r\nMasukkan angka saja");
          }
        }
        eksepsiInpOctal();
      }
    }   
    public static void eksepsiInpHexadecimal(){
      inputDesJOption();
      try{
        _validDes = Integer.parseInt(_des);
        String decBin = ConvertAP(_validDes, 16);
        JOptionPane.showMessageDialog(null, _validDes + " dalam hexadecimal adalah " + decBin);
      }catch(NumberFormatException ex){
        if(_des == null){
          JOptionPane.showMessageDialog(null, "Tolong Masukkan angka saja");
        }else{
          if(_des.isEmpty()){
            JOptionPane.showMessageDialog(null, "Inputtan anda kosong");
          }else{
            JOptionPane.showMessageDialog(null, _des + " bukan angka!\r\nMasukkan angka saja");
          }
        }
        eksepsiInpHexadecimal();
      }
    }
    public static void inpNama(){
      _name = JOptionPane.showInputDialog("Masukkan nama Anda : ");
      try{
        if(_name.isEmpty()){
          JOptionPane.showMessageDialog(null, "Nama tidak boleh kosong");
          inpNama();
        }else{
            for(int i=0;i<_name.length();i++){
                if(!Character.isLetter(_name.charAt(i))){
                    JOptionPane.showMessageDialog(null, "Nama hanya bisa mengandung huruf");                   
                    inpNama();
                    break;
                }
            }
        }
      }catch(NullPointerException ex){
        JOptionPane.showMessageDialog(null, "Harap diisi nama dulu donk");
        inpNama();
      }
    }
    public static void inpKelamin(){
      String[] jGender = {"LAKI-LAKI","WANITA"};
      int response;
      response = JOptionPane.showOptionDialog(null, "Pilih jenis kelamin anda:", "jenis kelamin", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, jGender, null);
      switch(response){
        case 0:
          _gender = "L";
          break;
        case 1:
          _gender = "W";
          break;
        case -1:
          _gender = null;
          JOptionPane.showMessageDialog(null, "Anda harus menentukan jenis kelamin anda");
          inpKelamin();
      }
    }   
    public static void menuJOption(){
      inpNama();
      inpKelamin();
      String salutation = !"L".equals(_gender) ? "Mbak" : "Mas";
     
      String[] pilihan = {"Biner","Hexadecimal","Octal","Kembali Ke Nama","Bilangkan","Pecahan","<< Keluar >>"};
      while(true){
        int response = JOptionPane.showOptionDialog(null, "Selamat datang " +salutation + " " + _name + "\r\nPilih konversi bilangan dibawah ini:", "konversi",JOptionPane.CLOSED_OPTION,JOptionPane.QUESTION_MESSAGE,null, pilihan,null);
        switch(response){
          case 0:
            eksepsiInpBiner();
            break;
          case 1:           
            eksepsiInpHexadecimal();
            break;
          case 2:
            eksepsiInpOctal();
            break;
          case 3:
            menuJOption();
            break;
          case 4:
              outTerbilang();
            break;
          case 5:
              hasilPecahan();
          case 6:
          case-1:
              System.exit(0);
              break;
          default:
            JOptionPane.showMessageDialog(null, "Response tidak terduga " + response);break;
        }
      }
    }
   
   
    public static void main(String[] args){          
     menuJOption();
     
      //menuJOption();
    }
  //~Methods
}




















Minggu, 09 September 2012

PHP: Konversi Bilangan Desimal

MEMBUAT SENDIRI KALKULATOR KONVERSI DESIMAL

Kali ini saya akan memberikan tutorial tentang bagaimana membuat kalkulator konversi sederhana dengan PHP.Kita dapat mengkonversi desimal ke bilangan oktak,hexa dan biner dalam kalkulator buatan kita ini.
Langsung saja ,langkah langkahnya dibawah ini:

1.buatlah file dengan nama back.php.Nama file tersebut  bisa dirubah atau disesuaikan.

<?php
if (isset($_POST['submit'])){
    $nama=$_REQUEST['nama'];
    if(isset($_POST['gender'])){
        $gender=$_REQUEST['gender'];
    }
    else{
        $gender='';
    }
    $cek='';
}
else{
    $nama='';
    $gender='';
    $cek="you have to fill the field completely";
    }
?>
<!DOCTYPE html>

<html>
    <head>
   
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Conditional</title>
    </head>
    <style type="text/css">
a:link{color:#FF0000}
a:visited{color:#660099}
a:hover{color:#FFFF00}
a:active{color:#000000}
</style>
</head><body background="background.png">
    <script language="JavaScript">
<!--
window.alert("Welcome");
//-->
</script>
          <h1><?echo $cek?></h1><br>
        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form1">
            <p>Name : <input type="text" name="nama" value="<?php echo $nama?>"/></p>
            <p>sex : <input type="radio" name="gender" value="L"
                      <?php ($gender=="L")? print 'checked=""': print '';?>/>
        Male
        <input type="radio" name="gender" value="P"
              <?php ($gender=="P")? print 'checked=""': print ''; ?>/>
        Female </p>
            <input type="submit" name="submit" value="submit"/>
        </form>
                 <?php
        if (isset($_POST['submit'])) { // apakah data ter-sumbit?
            /*membuat variabel untuk menyimpan data yang dikirim*/
            $nama=$_REQUEST['nama'];
            if(isset($_POST['gender'])){
                $gender=$_REQUEST['gender'];
            }
            else{
                $gender='';
            }
            //cek apakah data yang dikirim tidak kososng
        if($nama==''  || $gender==''){
            echo'<h2>You are not fill the field completely </h2>';
        } else {
            /*cek jenis kelamin*/
            if ($gender=='L'){
                echo '<h2>Welcome Bro,  '.$nama.'!!</h2>';
            } else{
                echo'<h2>Welcome Sis,   '.$nama.'!!</h2>';
            }
        }
        echo "<a href='validation.php'> Click to start convertion </a>"; // HASIL ,
            }
        ?>
    </body>
</html>

script diatas akan menghasilkan form seperti ini:

bila telah berjalan seperti diatas maka kita akan menuju langkah ke2.

2.buat file php dengan nama validation.php lalu ketikan script seperti dibawah ini:

<?php
error_reporting(0);
$des = $_REQUEST['des'];//deklarasi var desimal
$option = $_REQUEST['option'];//deklarasi var pilihan
  function oct($des){      
   echo("jadi octal dari".$des." adalah ".decoct($des) . "<br />");
   
    }
function hexa($bil){
$decimal=$bil;
$ori=$decimal ;
    $hex =dechex($decimal);
    $result = strrev($hex);
      return "Bilangan $ori (desimal) dalam bentuk hexadesimal adalah $result";
 
}

function bin($bil){
      $decimal= $bil;
      $ori=$decimal;
                $binary= decbin($decimal);
                $result = strrev($binary);
      return "Biner dari : $ori adalah : $result <br/>"; //funngsi ini mereturn hasil
    }

?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
      <style type="text/css">

a:link{color:#FF0000}
a:visited{color:#660099}
a:hover{color:#FFFF00}
a:active{color:#000000}
</style>
 
    <body >
                <form action="<?php echo $_SERVER['PHP_SELF']; ?>"
                method="post" name="form1" id="style">
            <p>Inputkan : <input type="text" name="des" value="<?php echo $des ?>" /></p>
            <p>Pilih konversi : <br/>
                <input type="radio" name="option" value="bin"
                    <?php ($option=="bin") ? print 'checked=""': print ''; ?>/>
                        Desimal ke Biner<br/>
                <input type="radio" name="option" value="hex"
                    <?php ($option=="hex") ? print 'checked=""': print ''; ?>/>
                        Desimal ke Hexa<br/>
                <input type="radio" name="option" value="oct"
                    <?php ($option=="oct") ? print 'checked=""': print ''; ?>/>
                        Desimal ke Octal<br/>
            </p>
            <input type="submit" name="submit" value="Submit"/>
        </form>
        <?php
            if(isset($_POST['des'])){ //apakah data tersubmit?
                /*mambuat variable untuk menyimpan data yang dikirim*/
                $des = $_REQUEST['des'];
                $option = $_REQUEST['option'];
                //cek apakah data yang dikirim tidak kosong ?
                if($des=='' || $option==''){
                    echo '<h2>Sorry data not complete</h2><br>';
                    echo "<a href='".$_SERVER['PHP_SELF']."'>Reset</a>";
                }
                else{
                    //cek jenis kelamin
                    switch($option){
                        case 'bin' : echo "<h3>".bin($des)."</h3>"; break;
                        case 'hex' : echo "<h3>".hexa($des)."</h3>"; break;
                        case 'oct' : echo "<h3>".oct($des)."</h3>"; break;
                        default : break;
             
                  }
                }
             
              }echo "<br><a href='back.php'>back to the login page </a>";
         ?>
    </body>
</html>

bila berjalan dengan baik maka hasil akhirnya akan seperti gambar dibawah ini:

ini akan muncul saat pertama kali kita menjalankan program dan alert tersebut terbuat dari javacript




gambar dibawah akan terjadi ketika kita belum lengakp mengisi form






dan gambar dibawah akan terjadi apabila kita telah mengisi dengan lengkap data/form tersebut








hasil konversi





Twitter Delicious Facebook Digg Stumbleupon Favorites More