jadi pencariannya sesuai dengan nama kota dan beratnya gan
dan klo saya punya database kaya gini gimana gan :
-- Database: `ongkir`
--
-- --------------------------------------------------------
--
-- Table structure for table `daftarkota`
--
CREATE TABLE IF NOT EXISTS `daftarkota` (
`id` INT(11) NOT NULL,
`kodekota` VARCHAR(10) NOT NULL,
`namakota` VARCHAR(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `daftarkota`
--
INSERT INTO `daftarkota` VALUES (1, 'kota1', 'belawan'),(2, 'kota2', 'binjai');
-- --------------------------------------------------------
--
-- Table structure for table `service_cepat`
--
CREATE TABLE IF NOT EXISTS `service_cepat` (
`id` INT(11) NOT NULL,
`namakota` VARCHAR(10) NOT NULL,
`KGpCPT` VARCHAR(10) NOT NULL,
`KGsCPT` VARCHAR(10) NOT NULL,
`BtKGpCPT` VARCHAR(10) NOT NULL,
`BtKGsCPT` VARCHAR(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `service_cepat`
--
INSERT INTO `service_cepat` VALUES
(1, 'Belawan', '40000', '30000', '20000', '10000'),
(2, 'Binjai', '50000', '40000', '30000', '20000');
-- --------------------------------------------------------
--
-- Table structure for table `service_standar`
--
CREATE TABLE IF NOT EXISTS `service_standar` (
`id` INT(11) NOT NULL,
`namakota` VARCHAR(10) NOT NULL,
`KGpSTD` VARCHAR(10) NOT NULL,
`KGsSTD` VARCHAR(10) NOT NULL,
`BtKGpSTD` VARCHAR(10) NOT NULL,
`BtKGsSTD` VARCHAR(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `service_standar`
--
INSERT INTO `service_standar` VALUES
(1, 'Belawan', '20000', '15000', '10000', '5000'),
(2, 'Binjai', '25000', '20000', '15000', '10000');
dan saya buat dengan coding php begini masih error terus gan :
<?PHP
if(isset($_POST['cek'])){
$conn = mysql_connect("localhost", "root", "");
mysql_select_db("ongkir");
$Kota = $_POST['namakota'];
$KGp = $_POST['KGpCPT'.'KGpSTD'];
$KGs = $_POST['KGsCPT'.'KGsSTD'];
$BtKGp = $_POST['BtKGpCPT'.'BtKGpSTD'];
$BtKGs = $_POST['BtKGpCPT'.'BtKGpSTD'];
$BB = $_POST['berat'];
$total = $_POST['tarifcepat','tarifstandar']
$sql = "select * from daftarkota, service_cepat, service_standar where namakota, KGpCPT, KGsCPT,BtKGpCPT,BtKGsCPT, KGpSTD, KGsSTD,BtKGpSTD,BtKGsSTD like '%$total%' or namakota, KGpCPT, KGsCPT,BtKGpCPT,BtKGsCPT, KGpSTD, KGsSTD,BtKGpSTD,BtKGsSTD like '%$total%'";
$result = mysql_query($sql);
if(mysql_num_rows($result) > 0);
while($tujuan = mysql_fetch_array($result));
$total = $KGp + $BtKGp;
$sisa = $BB - 1;
if($sisa > 0){
$total += ($sisa * $KGs);
$total += ($sisa * $BtKGs);
}
}?>
<form action="" method="post">
<table width="100%" border="0">
<tr>
<td>Tujuan</td>
<td><input type="text" name="namakota" id="namakota"/></td>
</tr>
<tr>
<td>BeratKiriman</td>
<td><input type="text" name="berat" id="berat"/></td>
</tr><tr>
<td> </td>
<td><input type="submit" value="cek" name="search"/></td>
</tr>
</table>
</form><?php
while($tujuan = mysql_fetch_array($result)){?>
<table align="center">
<tr>
<td>Tujuan</td>
<td><?php echo $tujuan['namakota'];?></td>
</tr>
<tr>
<td>Service Cepat</td>
<td ><?php echo $total['Tarifcepat'];?></td>
</tr>
<tr>
<td>Service Standar</td>
<td ><?php echo $total['Tarifstandar'];?></td>
</tr>
</tr>
mohon dipandu lagi gan