• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




Saturday, July 28, 2012

SELECT OPTION IN PHP

Hi.. welcome in my site… at “We Are Knowledge”… Many knowledge in here… you can getting IT knowledge in here, like as : PHP, HTML, VB, PASCAL, COBOL, and other…

But.., now I want giving you knowledge about “PHP” and discuss “OPTION IN PHP”…

You know “OPTION IN PHP … ? “

Define option in PHP is form that has been provided by “PHP” and function is saving many word or more than one word… and form drop down…

Ok we direct to program code…

Example 1 :

This is just choice one from one option
You can copy it… or you write your own in order to you can easier to understand..

<html>
<head> We Are Knowledge <br> <br>
<title> OPTION IN PHP </title>
</head>
<body>
<form method = "POST" action = "wak7.php">
<table border = "3" cellpadding = "1" cellspacing = "1" align = center>
<tr>
<td>
<select name = "INDONESIA_FC">
<option value = "">- select one -</option>
<option value = "sriwijaya">sriwijaya</option>
<option value = "persija">persija</option>
<option value = "persib">persib</option>
<option value = "arema">arema</option>
<option value = "persipura">persipura</option>
</select>
<br><br><br>
<input type = submit value = "SEND">
</table>
</form>
</body>
</html>

Next.. paste in your notepad and save with save as type “HTML”
And this file.php…

You can copy this

<?php
echo "Your Favorit FC in Indonesian is : ", $_POST[INDONESIA_FC];
?>

If it is.. save with save as type “PHP”…
DON’T FORGET… give name = “wak7.php”….

And result is :

We Are Knowledge


Top of Form
      




If you choice “persija” next press “send”… and result is

Your Favorit FC in Indonesian is : persija

In new tab ….!!!


Example 2 :

This using 2 (two) option…

You can copy this and paste in your notepad

<html>
<head> We Are Knowledge <br> <br>
<title> OPTION IN PHP </title>
</head>
<body>
<form method = "POST" action = "wak7.php">
<table border = "3" cellpadding = "1" cellspacing = "1" align = center>
<tr>
<td>
<select name = "I_F">
<option value = "">- select one -</option>
<option value = "GADO - GADO">GADO - GADO</option>
<option value = "KETOPRAK">KETOPRAK</option>
<option value = "GUDEG">GUDEG</option>
<option value = "EMPEK - EMPEK">EMPEK - EMPEK</option>
<option value = "NASI PADANG">NASI PADANG</option>
</select>
<br><br>
<select name = "I_G">
<option value = "">- select one -</option>
<option value = "PETAK UMPET">PETAK UMPET</option>
<option value = "KELERENG">KELERENG</option>
<option value = "EGRANG">EGRANG</option>
<option value = "ULAR NAGA">ULAR NAGA</option>
<option value = "BENTENG">BENTENG</option>
</select>
<br><br><br>
<input type = submit value = "SEND">
</table>
</form>
</body>
</html>

Save with save as type = “HTML”…

This for file.php

Copy this coding !!!!

<?php
echo "Your Favorit Indonesian food is : ", $_POST[I_F]."<BR>";
echo "Your Favorit Indonesian game is : ", $_POST[I_G];
?>

Next.. don’t FORGET give name = “wak7.php” … you must DO IT !!!...

And If it is  to result :

We Are Knowledge


Top of Form
      

      



If you choice “GUDEG” and “ULAR NAGA”.. then press “SEND” and to appear next tab… result is…

Your Favorit Indonesian food is : GUDEG
Your Favorit Indonesian game is : ULAR NAGA


Ok… just it…
I hope you understand with my tutorial…
Thanks for you…
See you later

No comments:

Post a Comment