What Will I Learn?
- We will learn how to create a data input application transport
- We will learn to input data into the database using PHP
- We will learn how to work from the application data input transport
Requirements
- Text editor
- Xampp
- Browser application
- Basic pemanjaman pempaman php and html
Difficulty
- Intermediate
Tutorial Contents
Input
Input is all data and commands that are inserted into computer memory for further processed by processor. An input device is a hardware component that allows users or users to enter data into a computer, or it may also be referred to as an external unit used to input data from outside into a microprocessor.
Output
Output is data that has been processed into usable form. This means that the computer processes the data entered into an information. The so-called output devices are all hardware components that convey information to the people who use them.
First prepare database with the name of the plane.
Then create a table in it with the name of the plane.
And give a table with 8 coloms
Make the data as follows.
- After the data base is completed we make now we just make the main from this application is index.php file is for the tool to input passenger data into databes.
index.php
"
< !DOCTYPE html>
< !-- Author: SunDi3yansyah -->
< html>
< head>
< title>Penginputan Data Pesawat
< meta charset="utf-8">
< meta http-equiv="X-UA-Compatible" content="IE=edge">
< meta name="viewport" content="width=device-width, initial-scale=1">
< link rel="stylesheet" href="style.css">
< link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
< !-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
< !-- WARNING: Respond.js doesn't work if you view the page via file:// -->
< !--[if lt IE 9]>
< script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
< script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
< ![endif]-->
< /head>
< body>
< form class="bg-info" action="proses_simpan.php" method="post" name="pesawat" id="tiket">
< table width="600" border="0" align="center" cellpadding="0" cellspacing="10">
< div class="f-center">< h1>Penginputan Data Pesawat< /h1>
< tr>
<td>:< /td>
<td><input class="form-control" type="text" name="nomor_reservasi"></td>
<td class="td-title">Nama Pemesan</td>
<td>:</td>
<td><input class="form-control" type="text" name="nama_pemesan"></td>
<td class="td-title">Tujuan</td>
<td>:</td>
<td><select class="form-control" name="tujuan" id="tujuan">
<option value="Yogyakarta">Yogyakarta</option>
<option value="Singapura">Singapura</option>
<option value="Hongkong">Hongkong</option>
<option value="aceh">aceh </option>
</select></td>
<td class="td-title" style="padding-top:0px;">Jenis Tiket</td>
<td></td>
<td>
< p>
< label>
< input type="radio" name="jenis_tiket" value="reguler" id="jenis_tiket">Reguler< /label>
< br>
< label>
< input type="radio" name="jenis_tiket" value="promosi" id="jenis_tiket">Promosi< /label>
< br>
< /p>
< /td>
< /tr>
< /table>
< div class="submit">
< input class="btn btn-primary" type="submit" name="button" id="button" value="SIMPAN">
< input class="btn btn-primary" type="reset" name="button2" id="button2" value="RESET">
< /div>
< br>
< /form>
< script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js">< /script>
< /body>
< /html>
"
- After index.php we have created next we make the first connection between sourcode with database we have prepared earlier.
koneksi.php
"
< ?php
$koneksi=mysql_connect("localhost","root","");
mysql_select_db("pesawat",$koneksi);
? >
"
- After that we create a process to store data in this file data will be stored into the data base that we created earlier by way of data must be input first by the user.
proses_simpan.php
"
< !DOCTYPE html>
< !-- Author: SunDi3yansyah -->
< html>
< head>
< title>Proses Simpan
< meta charset="utf-8">
< meta http-equiv="X-UA-Compatible" content="IE=edge">
< meta name="viewport" content="width=device-width, initial-scale=1">
< link rel="stylesheet" href="style.css">
< link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
< !-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
< !-- WARNING: Respond.js doesn't work if you view the page via file:// -->
< !--[if lt IE 9]>
< script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
< script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
< ![endif]-->
< /head>
< body>
< br style="padding-top:50px;"/>
< div class="cont">
< p class="bg-danger f-center" style="padding: 10px;">
< ?php
include "koneksi.php";
$nomorreservasi=$_POST['nomor_reservasi'];
$namapemesan=$_POST['nama_pemesan'];
$tujuan=$_POST['tujuan'];
$tiket=$_POST['jenis_tiket'];
if ($tujuan=="Yogyakarta"){$biayatujuan='350000'; $biayapokok='100000';}
else if ($tujuan=="Singapura"){$biayatujuan='1000000'; $biayapokok='250000';}
else if ($tujuan=="Hongkong"){$biayatujuan='2000000'; $biayapokok='250000';}
else if ($tujuan=="aceh"){$biayatujuan='4000000'; $biayapokok='250000';}
if ($tiket=="promosi"){$potongan=0.75*$biayatujuan;}
else {$potongan=0;}
$total= $biayatujuan+$biayapokok - $potongan;
mysql_query("insert into
pesawat(no_reservasi,nama_pemesan,tujuan,biaya_tujuan,biaya_pokok,potongan,total,jenis_tiket)
values
('$nomorreservasi','$namapemesan','$tujuan','$biayatujuan','$biayapokok','$potongan','$total','$tiket')",
$koneksi);
echo "<span class=\"saved\">Data Tersimpan</span> "
?>
< br/>
< br/>
< a class="btn btn-success" href="index.php">Input Kembali Lihat Data
< /p>
< /div>
< script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js">
< /body>
< /html>
"
- And the last step is to group all the data that has been input into the database and will be seen on this hamalan. And finished.
tampil_data.php
"
< !DOCTYPE html>
< !-- Author: SunDi3yansyah -->
< html>
< head>
< title>Tampil Penginputan Data Pesawat
< meta charset="utf-8">
< meta http-equiv="X-UA-Compatible" content="IE=edge">
< meta name="viewport" content="width=device-width, initial-scale=1">
< link rel="stylesheet" href="style.css">
< link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
< !-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
< !-- WARNING: Respond.js doesn't work if you view the page via file:// -->
< !--[if lt IE 9]>
< script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
< script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
< ![endif]-->
table{background-color:#996;padding:0px;width:100%;}
td{background-color:#066;color:#fff;padding:5px;}
< /style>
< /head>
< body>
< div class="cont" style="margin="10px auto 0">
< div class="bg-danger f-center" style="padding: 10px;">
< div class="f-center"> < h1>Tampil Penginputan Data Pesawat< /h1>< /div>
< ?php
include "koneksi.php";
$sql="select*from pesawat order by no_reservasi desc limit 8";
$query=mysql_query($sql);
while ($row=mysql_fetch_array($query))
{$noreservasi=$row['no_reservasi'];
$namapemesan=$row['nama_pemesan'];
$tujuan=$row['tujuan'];
$biayatujuan=$row['biaya_tujuan'];
$biayapokok=$row['biaya_pokok'];
$potongan=$row['potongan'];
$total=$row['total'];
$tiket=$row['jenis_tiket'];
? >
< table>
< tr>
< td>Nomor Reservasi
< /tr>
< tr>
< td>Nama Pemesan< /td>< td> :< /td>< td>< ?php echo $namapemesan; ?>< /td>
< /tr>
< tr>
< td>Tujuan< /td>< td> :< / td>
< /tr>
< tr>
< td>Jenis Tiket< /td>< td> :< /td>< td>< /td>
< /tr>
< tr>
< td>Biaya Tujuan< /td>< td> :< /td>< td><?php echo $biayatujuan; ? >< /td>
< /tr>
< tr>
< td>Biaya Pokok< /td>< td> :< /td>< td>< ?php echo $biayapokok; ?></ td>
< /tr>
< tr>
< td>Potongan< /td>< td> :< / td>< td>< ?php echo $potongan; ?>< /td>
< /tr>
< tr>
< td>Total< /td>< td > :< / td>< td>< ?php echo $total; ?>< /td>
< /tr>
< ?php
}
?>
< /table>
< br/>< a class="btn btn-primary" href="index.php">Input Data Lagi< /a>
< /div>
< /div>
< script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js">
< /body>
< /html>
"
- Next is run the program run the program http: // localhost / plane and will look from like this.
- after that enter the data and then click simpan
- and then it will look like this after that click Lihat to see all the data that has been input to the database.
and finis How to create application inputting passenger data plane using PHP programming MYSQL
Posted on Utopian.io - Rewarding Open Source Contributors
Hello,
We have found that all or part of the above post may have been copied from: https://github.com/wh04mi/input-ticket/blob/master/index.php
Not indicating that the content you post including translations, spun, or re-written articles are not your original work could be seen as plagiarism.
These are some tips on how to share content and add value:
Repeated plagiarized posts are considered spam. Spam is discouraged by the community, and may result in action from the cheetah bot.
If you are actually the original author, please do reply to let us know!
Thank You.
More Info: Abuse Guide - 2017.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Your contribution cannot be approved because it does not follow the Utopian Rules, and is considered as plagiarism. Plagiarism is not allowed on Utopian, and posts that engage in plagiarism will be flagged and hidden forever.
Plagiarised from here.
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit