Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pl">
- <head>
- <meta charset="utf-8">
- <link rel="stylesheet" type="text/css" href="style.css">
- <title>TiTLe</title>
- </head>
- <body>
- <form action="tnjkp.php" method="GET">
- a:<input type="number" name="a"><br>
- b:<input type="number" name="b"><br>
- <input type="submit" value="wo">
- </form>
- <?php
- function suma($x, $y){
- $s=$x+$y;
- return $s;
- }
- if(isset($GET["a"]) && $_GET["a"]!="" &&_GET["b"]!=""){
- //polaczenie z baza danych:
- $serverName="localhost";
- $userName="root";
- $pass="";
- $dbName="prostokat";
- $conn=mysqli_connect($serverName,$userName,$pass,$dbName);
- if(!$conn) {
- die("blad polaczenia".mysqli_connect_error());
- }
- $sql="insert into dane (a,b) values(".$_GET["a"].",".$_GET["b"].");";
- $wynik=mysqli_query($conn,$sql);
- if(!wynik){ die ("wynik zapytania blad");}
- else{
- $wynik=suma($_GET["a"],$_GET["b"]);
- echo "<br> Wynik działania funkcji suma:".$wynik."<br>Zawartosc tabeli z bazy danych<br>";
- }
- mysqli_close($conn);
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement