Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <?php
- $con = new PDO("mysql:host=localhost;dbname=employees", "root","");
- $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $statement = $con->prepare("SELECT idISO, name FROM iso");
- $statement->execute();
- $countries = $statement->fetchALL(PDO::FETCH_OBJ);
- if ($_SERVER["REQUEST_METHOD"] == "POST") {
- $name = $_POST["personname"];
- $idISO = $_POST["idISO"];
- $namee = $_POST["name"];
- $codee = $_POST["code"];
- //var_dump($countryId);
- //var_dump($name;
- $statement = $con->prepare("INSERT INTO iso(personname, idISO, name, code) VALUES(?, ?, ?, ?)");
- $statement->bindValue(1, $name);
- $statement->bindValue(2, $idISO);
- $statement->bindValue(3, $namee);
- $statement->bindValue(4, $codee);
- $statement->execute();
- }
- ?>
- <head>
- </head>
- <body>
- <form method ="post">
- <input type="text" name="personname">
- <input type="text" name="code">
- <select name ="idISO">
- <?php
- foreach($countries as $country)
- {
- echo "<option value='$country->idIso'>$country->name</option>";
- }
- ?>
- </select>
- <input type="submit" name="name" value = "sla op">
- </form>
- <select>
- </select>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement