Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>Page Title</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" type="text/css" media="screen" href="main.css">
- <script src="main.js"></script>
- </head>
- <body>
- <h2>
- Strona
- </h2>
- <div>
- <?php
- if(isset($_POST['data']) && isset($_POST['tekst'])){
- $username = "ziembajakub";
- $password = "ziembaj";
- $host = "localhost";
- $dbName = "ziembajakub";
- $data = $_POST['data'];
- $text = $_POST['tekst'];
- $sql2 = "insert into tab1 (id, text, data) values (null,'$text', '$data');";
- $con = mysqli_connect($host,$username,$password,$dbName);
- if(!$con){
- echo "Error: ".mysqli_error($con);
- }
- $sql = "select * from tab1;";
- $result = mysqli_query($con,$sql);
- $result2 = mysqli_query($con,$sql2);
- if($result2){
- echo "gicik";
- }
- if($result){
- while($row = mysqli_fetch_assoc($result)){
- echo "<div>".$row['id']." ".$row['text']." ".$row['data']."</div>";
- }
- }
- mysqli_close($con);
- }
- // $imie = $_POST['imie'];
- // $wiek = $_POST['wiek'];
- // $kolor = $_POST['kolor'];
- // $tekst = $_POST['tekst'];
- // echo "<p>".$imie."</p><br><p>".$wiek."<br><p style='background-color:".$kolor."'>".nl2br($tekst)."</p><br>";
- // echo str_replace("-",".",$_POST['data']);
- // ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement