Mobile Application Development Trainer (Android, Phonegap, HTML5, CSS3, SQLite JSON)

Hery Purnama 081.223344.506 – Freelance Certified IT Trainer  Android Phonegap, , Excel VBA Macro , Google Map API, Google Sketchup3D , MS Project, ExtJS, Oracle, SQL Server, MySQL, MS. Access VBA, Primavera P6, MS Project (others ) Berpengalaman 15 Tahun sebagai Trainer bersertifikasi

Hery Purnama 081.223344.506 , IT trainer , Excel / access VBA Macro, MS Project, Primavera,

PHP Ajax Jquery, Google Map API, Google Sketchup3D, Ubuntu, Sencha ExtJS, YII, Code Igniter,
Oracle, SQL Server,
Bandung, Jakarta, Bali, Medan, Surabaya, Yogya, Indonesia

Hery Purnama – 081.223344.506 – inhousetrainer@yahoo.com.
Freelance IT Trainer, Trainer Excel VBA Macro, Trainer Sencha ExtJS, Trainer Google Map API, Trainer SPSS, Trainer MS Project, Trainer Primavera, Trainer Google Sktechup 3D, Trainer Android Phonegap, Trainer Oracle, Trainer SQL Server, Trainer MySQL, Trainer PHP Jquery Mobile , Trainer Java, Trainer HTML5 Javascript, Trainer SEO Internet Marketing, Trainer Project Management, Trainer SMS Gateway, Trainer CMS WordPress, ITIL, COBIT

Integrating HTML5, CSS and PHP to Create a Very Basic Contact Form

HTML5 has been helping webmasters to clean up their code by utilising newly introduced features of the same. It won’t be possible for me to touch base with every HTML5 feature, but I will be listing down some of those during the course of this tutorial.

Forms are an integral part of any website that wants its visitors to get in touch with the owner of that website. They bridge the gap virtually between the webmaster and the website visitor.

Here, we will implement a very basic combination of HTML5 with CSS and PHP in order to create a contact form. You might have created a lot of contact forms but our purpose here is to do the same using the appreciable features of HTML5. Let’s do it!

Note: The code below will work with most of the Internet browsers that are being widely used as of today.

Our Goal

For starters, you must have an idea of what we are going to create. It will be a simple contact form as shown below:

Catching up with HTML5

Without further discussions, let’s create our first index.php file. Please be aware that you will require a web server to test index.php file. Explaining the setup of same is out of the scope of this tutorial.

The very initial index.php will look like this:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>My Contact Form</title>
</head>
<body>
    <header class="main">
        <h1>My Contact Form</h1>
    </header>
    <section class="main">
        [Form code goes here]
    </section>
</body>
</html>

See any differences from your regular html code?

Well, there are few. Let me explain each of them:

    The cleanest ever DOCTYPE -In case you haven’t noticed, the above HTML5 code boasts of a very clean DOCTYPE tag. If you have worked with earlier versions of HTML5 then you will understand what I mean and why am I emphasizing on it. If you haven’t seen the DOCTYPE tag before then ignore this and move on.
    The <header> and <section> tags – Ever used these tags in earlier versions of HTML? Well, now you can and avoid the usage of div tags. Both the tags have been assigned a class “main” so that I am comfortable styling them as I want using my style.css. HTML5 also has a <footer> tag which will be used (obviously) for footer of your webpage.

The Form:

Now, lets talk about the code that will shape our form (the very purpose of this tutorial). The below code will be placed in our section tag (unless you are planning to push your form to the header or footer section of your webpage.)

<form>
       <label>Your Name:</label>
       <input name="name" placeholder="Goes Here">
       <label>Your Email:</label>
       <input name="email" type="email" placeholder="Goes Here">
       <label>Your Message:</label>
       <textarea name="message" placeholder="Goes Here"></textarea>
       <input id="submit" name="submit" type="submit" value="Submit">
</form>

Again, you will notice differences between the above HTML5 code and our old versions. Let me throw some light:

    <input> tag need not be closed – Older versions of HTML wanted <input/> while HTML5 is satisfied with <input>. Quiet clean, right?
    type = “email” enhances iPhone experience – Although browsers that do not understand type=”email” in above code will assume it to be type=”text” yet iPhone makes your life a bit easier. It adds a @ symbol button in its keypad when the type=”email” field is active. Cute?
    placeholder makes life easy – If you noticed the image of our upcoming form above, then you will see the text “Goes Here” in every field. I remember spending hours with JavaScript so as to make this possible. HTML5 makes this a cakewalk!

Now, our very own CSS

That was it! Our HTML5 tutorial is over and we move on to CSS to style our HTML5 form. For starters, place the below code just above your <body> tag so as to tell your index.php that someone out their is ready to make her beautiful.

<link type="text/css" rel="stylesheet" href="style.css">

Now create a style.css in the same folder and paste the below code into it.

label {
    display:block;
    margin-top:50px;
    letter-spacing:1px;
}

/* This section centers our complete page */
.main {
    display:block;
    margin:0 auto;
    width:500px;
}

/* This section centers the form inside our web page*/
form {
    margin:0 auto;
    width:420px;
}

/* Applying styles to our text boxes */
input, textarea {
    width:400px;
    height:27px;
    background:#666666;
    border:2px solid #f6f6f6;
    padding:10px;
    margin-top:10px;
    font-size:0.7em;
    color:#ffffff;
}

textarea {
    height:200px;
    font-family:Arial;
}

#submit {
    width:85px;
    height:35px;
    background:url(submit.png);
    text-indent:-9999px;
    border:none;
    margin-top:20px;
    cursor:pointer;
}

Let me deconstruct the important parts of above code:

    The display:block property for label converts the <label> tags into block level elements. This pushes them to next line henceforth cleaning up the HTML5 form and pushing every thing to a new line.
    The text-indent:-9999px; property for #submit hides the actual “Submit” text so as to make room for the Submit Button (which I quickly created using Cool Text).
    I am assuming that rest of the code is self explanatory even if you are least familiar with CSS. Leave comments in case of confusions and I will be more than happy to get back to you.

PHP Integration

First, we edit the <form> tag in your code to what you see below:

<form method="post" action="index.php">

Now, insert the below code just above your <form> tag:

    <?php
       $name = $_POST['name'];
       $email = $_POST['email'];
       $message = $_POST['message'];
       $from = 'From: My Contact Form';
       $to = 'salman@mywebsite.com';
       $subject = 'Wassup?';

       $body = "From: $namen E-Mail: $emailn Message:n $message";

       if ($_POST['submit']) {
           if (mail ($to, $subject, $body, $from)) {
           echo '<p>Message Sent Successfully!</p>';
           } else {
           echo '<p>Ah! Try again, please?</p>';
           }
       }
    ?>

Once you save the above changes then your contact form should work as expected. It will send emails to your email address

Hery Purnama 081.223344.506 , IT trainer , Excel / access VBA Macro, MS Project, Primavera,

PHP Ajax Jquery, Google Map API, Google Sketchup3D, Ubuntu, Sencha ExtJS, YII, Code Igniter,
Oracle, SQL Server,
Bandung, Jakarta, Bali, Medan, Surabaya, Yogya, Indonesia

Hery Purnama – 081.223344.506 – inhousetrainer@yahoo.com.
Freelance IT Trainer, Trainer Excel VBA Macro, Trainer Sencha ExtJS, Trainer Google Map API, Trainer SPSS, Trainer MS Project, Trainer Primavera, Trainer Google Sktechup 3D, Trainer Android Phonegap, Trainer Oracle, Trainer SQL Server, Trainer MySQL, Trainer PHP Jquery Mobile , Trainer Java, Trainer HTML5 Javascript, Trainer SEO Internet Marketing, Trainer Project Management, Trainer SMS Gateway, Trainer CMS WordPress, ITIL, COBIT

Membuat wifi hotspot menggunakan laptop Anda – Create Hotspot using laptop

Create hotspot wifi using your personal laptop (windows 7)

Pada beberapa kondisi Anda ingin membagi koneksi internet yang ada di laptop anda yang terhubung dengan usb modem kepada teman teman Anda, dengan kata lain wifi  laptop anda akan berperan sebagai virtual router untuk dijadikan hotspot.


Yang saya maksud adalah :
> Koneksi yang anda bagi termasuk untuk device lain selain laptop , seperti smartphone atau tablet
> Bukan dengan metode wireless adhoc karena adhoc tidak bisa membagi jaringan ke selain laptop / komputer
> Bukan cara gampang dengan mentatering smartphone karena koneksi yang dibagi berasal dari USB modem laptop Anda
> Dari Smartphone tidak perlu setting static IP 192.168.137….. seperti informasi di internet
>Tanpa menggunakan software pihak ke3 seperti mhotspot, connectify, virtual router yang kadang tergantung dengan Service Pack Anda juga
Cara ini murni berasal dari windows 7 Anda !!
Jika anda menggunakan windows 8 caranya sangat mudah karena anda cukup mengubah setting adapter koneksi internet Anda dan membaginya (Shared)

Yang perlu dihindari saat akan melakukan setup dan konfigurasi adalah
1. Jangan dahulu melakukan shared adapter koneksi internet Anda
2. Tidak perlu mematikan sistem windows firewall Anda

Berikut tahapan membuat hostpot di laptop Anda

1. Internet Anda connect atau belum conect tidak masalah, namun pastikan dahulu service ICS dalam kondisi  Automatically bukan manual
2. Masuk command prompt (cmd) sebagai Administrator
3. Cek Status Wlan Driver Anda , ketik C:>netsh wlan show driver
    pastikan status "Hosted Network Supported : Yes"
4. lanjutkan dengan perintah perintah berikut :
    netsh wlan set hostednetwork mode=allow   <—- mengaktifkan mode hosted
    netsh wlan set hostednetwork ssid=hotguwe <—contoh nama hotspot anda nanti
    netsh wlan set hostednetwork key=hot12345678 <– password hotspot mode wpa
    netsh wlan start hostednetwork   <– menjalankan service hotspot anda
    netsh wlan show hostednetwork  <– mengecek status hotspot anda
7. Sekarang buka "Network and sharing Center" –> Change Adapter Setting –> Pilih Adapter Internet Anda dan ubah properti Sharing dengan mengaktifkan semua checkbox di bagian "Internet Connection Sharing" , lakukan perubahan juga pada "setting" lainnya dengan mengaktifkan https dan http (tergantung izin akses yang anda ingin berikan), saat anda menekan OK anda akan diminta memilih "Private Network" yang akan menerima sharing, pastikan anda memilih wireless connection dengan nama ssid yang anda telah buat (hotguwe)
8. Setelah tahap sharing selesai  perhatikan pada tampilan adapter adapter yang muncul akan ada tambahan (wireless connection adapter) dengan nama "hotguwe"
9. Kembali ke Cmd  jalankan perintah : netsh wlan stop hostednetwork  <– mematikan hotspot , lallu jalankan kembali dengan perintah : netsh wlan start hostednetwork
10. Selesai , sekarang coba cek android / smartphone anda , 1 buah koneksi wifi baru dengan nama hotguwe sudah muncul dan anda bisa mencoba masuk dengan key yang anda buat sebelumnya
11. untuk mengecek berapa koneksi yang sudah terhubung ke hotspot laptop anda gunakan perintah : netsh wlan show hostednetwork , lalu lihat status "number of clients "

Terima kasih semoga bermanfaat


English translation


In some cases you want to share the internet connection in your laptop connected to the USB modem to your friend's friends, in other words your laptop wifi will act as a virtual router to be used as a hotspot.
What I mean is:
> Sharing not only for other laptop, but it is for other device also such as a smartphone or tablet
> Not using wireless adhoc method for because adhoc networks can not be shared to smartphone
> From Smartphones do not need to set a static IP 192 168 137 ….. as information on the internet
> Without using 3rd party software like mhotspot, Connectify, a virtual router that sometimes depends on the Service Pack you also
This method is purely derived from windows 7 you !!

If you are using windows 8 is very easy because you can just change the adapter settings and share your internet connection (Shared)

Which should be avoided when making the setup and configuration is
1. Do not practicing shared your internet connection adapter
2. No need to turn off your firewall windows system

The following stages make hostpot on your laptop

1. you should verify that the ICS service in conditions not manually Automatically
2. Enter the command prompt (cmd) as Administrator
3. Check the status of your Wlan Driver, type C: > netsh wlan show drivers
    
verify the status of "Hosted Network Supported: Yes"
4. proceed with the following commands:
    
netsh wlan set hostednetwork mode = allow <—- activate hosted mode
    
netsh wlan set hostednetwork ssid = hotguwe <— example hotspot name you later
    
netsh wlan set hostednetwork key = hot12345678 <- password wpa fashion hotspot
    
netsh wlan start hostednetwork <- run your hotspot service
    
netsh wlan show hostednetwork <- check the status of your hotspot
7. Now open the "Network and Sharing Center" -> Change Adapter Settings -> Select Adapter and change the properties of your Internet Sharing to activate all checkboxes in the "Internet Connection Sharing", do also change the "settings" to activate https other and http (depending on the access permissions that you want to give), when you press OK you will be asked to select the "Private Network" which will receive a share, make sure you choose a wireless connection with ssid name that you have created (hotguwe)
8. After sharing the stage of completion notice on the display adapter adapter that appears to have additional (wireless connection adapter) with the name "hotguwe"
9. Back to Cmd run the command: netsh wlan stop hostednetwork <- turn off the hotspot, lallu rerun the command: netsh wlan start hostednetwork
10. Done, now try to check the android / your smartphone, 1 piece new wifi connection with hotguwe name already appears and you can try to get in with the key that you created earlier
11. to check how many connections are already connected to your laptop hotspot use the command: netsh wlan show hostednetwork, and see the status of "number of clients"

Thank you hopefully useful

by :

Hery Purnama 081.223344.506 , IT trainer , Excel / access VBA Macro, MS Project, Primavera,

PHP Ajax Jquery, Google Map API, Google Sketchup3D, Ubuntu, Sencha ExtJS, YII, Code Igniter,
Oracle, SQL Server,
Bandung, Jakarta, Bali, Medan, Surabaya, Yogya, Indonesia

Hery Purnama – 081.223344.506 – inhousetrainer@yahoo.com.
Freelance IT Trainer, Trainer Excel VBA Macro, Trainer Sencha ExtJS, Trainer Google Map API, Trainer SPSS, Trainer MS Project, Trainer Primavera, Trainer Google Sktechup 3D, Trainer Android Phonegap, Trainer Oracle, Trainer SQL Server, Trainer MySQL, Trainer PHP Jquery Mobile , Trainer Java, Trainer HTML5 Javascript, Trainer SEO Internet Marketing, Trainer Project Management, Trainer SMS Gateway, Trainer CMS WordPress, ITIL, COBIT