Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
- <body>
- <head>
- <meta charset="utf-8" />
- </head>
- <?php
- $servername = "mysql.cba.pl";
- $username = "trusjan";
- $password ="Qwerty1";
- $dbname = "trusjan";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $imie = $_POST["txt_imie"];
- $nazwisko = $_POST["txt_nazwisko"];
- $wiek = $_POST["cmb_wiek"];
- $plec = $_POST["radio_gender"];
- $image=addslashes(file_get_contents($_FILES['fileToUpload']['tmp_name']));
- $target_dir = "Uploads/";
- $target_file=$target_dir. basename($_FILES["fileToUpload"]["name"]);
- if(move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],$target_file)){
- echo "The file has been uploaded <br> ";
- }
- else{
- echo "Sorry, there was en error <br>";}
- $sql = "INSERT INTO `tb_person`(`Imie`, `Nazwisko`, `Wiek`, `Plec`, `image`) VALUES ('$imie','$nazwisko','$wiek','$plec','$image')";
- if ($conn->query($sql) === TRUE) {
- echo "New record created successfull";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- $conn->close();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement