Menggunakan PHP dan HTML

Bingung juga sih judul yang tepat apa. Cuma ada beberapa pertanyaan yang menanyakan bagaimana menggabungkan antara HTML dan PHP. Ya, bagi mereka yang belum paham cara kerja PHP memang bisa dimaklumi. Karena saya dulu juga bingung antara 2 bahasa ini hehehe..

Baiklah biar anda paham, coba anda bayangkan sebuah dapur. HTML adalah masakan sedangkan PHP adalah resep. Pengunjung website adalah pelanggan restoran.

Ketika anda menulis PHP, maka anda tengah menulis sebuah resep untuk membuat sebuah masakan yang sesuai keinginan anda. Sedangkan jika anda menulis HTML, itu sama aja anda menyajikan masakan yang sudah siap ke pengunjung. Paham?

Jadi, dari sisi pengunjung gak akan ada bedanya ini bahasa PHP atau HTML. Dari sisi kokilah perbedaan itu terjadi. So, mari kita coba dengan sebuah contoh:

Hallo, nama saya HTML

Kode diatas mudah ditebak bukan? Ya! itu adalah sebuah kode HTML yang menghasilkan tulisan Hallo, nama saya HTML. Kemudian mari kita coba tambahan kode PHP di sebelahnya:

Hallo, nama saya HTML

Kode diatas adalah sebuah kode PHP. Karena sudah ada tag php disana. Dan anda harus menjalankannya di server untuk melihat hasilnya. Jika anda jalankan langsung di browser dengan nama file coba.html, maka jelas akan error jadinya. Tapi jika anda jalankan di server dengan nama file coba.php, maka akan muncul tulisan:

Hallo, nama saya HTML dan saya adalah PHP

Itu adalah contoh menyisipkan kode PHP di HTML. Bisakah menyisipkan kode HTML di PHP? jelas bisa dong. Contohnya seperti ini:

Hallo, nama saya HTML dan saya adalah PHP


Tuh kan? Kita bisa menampilkan kode HTML dengan perintah echo di PHP. Keduanya sama-sama menghasilkan tulisan yang sama. Hanya saja pada contoh diatas saya tambahi tag strong dan em untuk memperlihatkan bahwa kita bisa memasang tag HTML di PHP.

Terserah anda mau pakai metode mana. Tapi yang jelas dan harus diingat, begitu di dalam keseluruhan file ada tag dan ?> maka file itu harus dijalankan di server. Karena perintah PHP hanya bisa berjalan di server saja. Oke, kita ketemu di artikel berikutnya

36 thoughts on “Menggunakan PHP dan HTML

  1. Pingback: Menggunakan PHP dan HTML | fitry12345

  2. Pingback: ayuendahprihatinningsih

    • untuk nampilin file php di browser secara offline dibutuhkan software xampp, kemudian pada browser diketik localhost/namafolder/

  3. I like the helpful information you supply in your articles.
    I will bookmark your blog and test again right here frequently.
    I’m reasonably certain I will learn plenty of new stuff right right here!
    Best of luck for the next!

  4. ini puisi saya

    pemandangan pagi

    kulihat cahaya sinar dipagi hari
    begitu indah menerangi bumi
    takan pernah tergantikan keindahanya
    begitu bermanfaat bagi manusia

    begitu kaya akan vitamin c
    engkaulah kekuatan kami
    makhluk hidup tidak akan bisa hidup tanpamu
    engkaulah matahari

  5. ini puisi saya
    pemandangan pagi

    kulihat cahaya sinar dipagi hari
    begitu indah menerangi bumi
    takan pernah tergantikan keindahanya
    begitu bermanfaat bagi manusia

    begitu kaya akan vitamin c
    engkaulah kekuatan kami
    makhluk hidup tidak akan bisa hidup tanpamu
    engkaulah matahari /

    Reply ↓

  6. Betberry is the official plus trusted agent in Dalam negri that provides soccer betting, casino, joker123
    shooting, s1288 dick fighting and online slot machine
    games. Betberry is one regarding the sites that offers been established since 2014.
    With a total of hundreds of thousands even more members throughout Indonesia, Betberry online betting
    is extremely popular ranging from teenagers to adults.
    Given the amount of enthusiasm of people, we all as a team created an established blog site of official2018 in order to
    provide more information plus knowledge about online wagering betting and the way to
    win bets.

    BETBERRY SITE IS FORMALLY RELIABLE gambling agent given that 2011
    Being a trusted online betting site with the particular largest number of users in Asia, has an official gambling site that will has been established given that 2011, namely Betberry.
    Betberry provides various games these kinds of as:

    Maxbet Ball Wagering Games,
    Sbobet Soccer Wagering Game,
    Online Casino Video games,
    Joker123 game shoot species of fish,
    The S1288 cock battle game,
    And much more.
    To accessibility Betberry it is likewise very an easy task to access, almost all you have to perform is copy
    the betberry url address create the link in a
    new new tab. Not only convenience, various bonuses provided by
    Betberry are also very various and interesting.
    Well, one of the best selling bonuses will be the welcome added bonus
    of 20% for sportsbook games. Only by looking into making the first deposit, your IDENTITY will
    immediately be added to 20% of the first deposit. How to claim this bonus is pretty
    easy, you only must confirm with CS, then the
    bonus will be filled. For withdrawals, it’s not
    also difficult you only possess to reach WIN 6x total (bonus + deposit), you can win WD
    with the 20% bonus that we get provided. Very exciting promo right?

    Betberry who has been exploring the world of online gambling for
    8 years. It usually would like to give the finest for every member or possible new members who would
    like to join. With Betberry’s trusted on-line betting site, consequently , a few of the
    leading sectors according to Betberry. The primary headlines or focus in order to be improved this coming year are usually as follows:

    Interesting Promos: Betberry is confident of which attractive gambling promos will surely
    make players feel more at ease playing.
    Faster DP / WD services: Betberry always offers faster
    processing providers and in less than 3 minutes you may play and withdraw
    their cash.
    daily service: 24 hour non-stop service, always providing the
    very best service and assisted simply by professional staff.

    Transactions with local banks: By supplying a local bank.
    Then it will be easier for you any time making a transaction.
    Most recent security technology: Your safety and privacy are the golden gates needed in order to maintain 100% as a lot
    as possible for your convenience.
    The noble mission of the Betberry agent, of course, is centered on rules and
    rules. Which incidentally has been around in the gambling world
    given that since the beginning. That is, producing the
    world of betting the most effective solutions for typically the public in the world.
    To play finance without having breaking the rules.
    The best solution is to provide the best online gambling game facility.
    In this particular way all activities and transactions must be done online
    without breaking the rules.

Leave a Reply

Your email address will not be published. Required fields are marked *