[Solved] Adding to a mySQL database [closed]


Here’s the tutorial from me so that you can able to post it with this code or even you try to modify this code based on your needs.

Here’s the code created on php code.

THE HTML CODE

<select name="KODECITIES">
     <option value=0 selected>- CITIES Code -</option>
     <?php
         $con = mysql_connect("localhost","root","");
         if (!$con)
         {
             die('Could not connect: ' . mysql_error());
         }
         mysql_select_db("CITIES TABLE", $con);

         $result = mysql_query("SELECT Kode FROM CITIES");
         while($row = mysql_fetch_array($result))
         {
             echo "<option value=$row[0]>$row[0]</option>";
         }

         mysql_close($con);
     ?>
</select> 

Then inside your php :

<?php
    if(isset($_POST['submitbutton']))
    {
        $kodecities = $_POST['KODECITIES'];
        echo $kodecities;
    }
?>

solved Adding to a mySQL database [closed]