Compare commits
No commits in common. "mpabi" and "75058e98b04d9094ec1b2fd2eec0dfd6887ddd5a" have entirely different histories.
mpabi
...
75058e98b0
|
@ -1 +0,0 @@
|
|||
*.swp
|
|
@ -1,60 +0,0 @@
|
|||
body {
|
||||
/* Center the form on the page */
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
form {
|
||||
display: inline-block;
|
||||
/* Form outline */
|
||||
padding: 1em;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 1em;
|
||||
}
|
||||
|
||||
p + p {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
label {
|
||||
/* Uniform size & alignment */
|
||||
display: inline-block;
|
||||
min-width: 90px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
input,
|
||||
textarea {
|
||||
/* To make sure that all text fields have the same font settings
|
||||
By default, textareas have a monospace font */
|
||||
font: 1em sans-serif;
|
||||
/* Uniform text field size */
|
||||
width: 300px;
|
||||
box-sizing: border-box;
|
||||
/* Match form field borders */
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
input:focus,
|
||||
textarea:focus {
|
||||
/* Additional highlight for focused elements */
|
||||
border-color: #000;
|
||||
}
|
||||
|
||||
textarea {
|
||||
/* Align multiline text fields with their labels */
|
||||
vertical-align: top;
|
||||
/* Provide space to type some text */
|
||||
height: 5em;
|
||||
}
|
||||
|
||||
.button {
|
||||
/* Align buttons with the text fields */
|
||||
padding-left: 90px; /* same size as the label elements */
|
||||
}
|
||||
|
||||
button {
|
||||
/* This extra margin represent roughly the same space as the space
|
||||
between the labels and their text fields */
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
49
index.php
49
index.php
|
@ -4,60 +4,21 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<form action="/my-handling-form-page" method="post">
|
||||
<p>
|
||||
<label for="Lastname">LastName:</label>
|
||||
<input type="text" id="Lastname" name="user_name" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="surname">FirstName:</label>
|
||||
<input type="text" id="Firstname" name="user_name" />
|
||||
<p>Test</p>
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="user_name" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="mail">Email:</label>
|
||||
<input type="email" id="mail" name="user_email" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="sub">Subject:</label>
|
||||
<textarea id="sub" name="user_sub"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="path">Path:</label>
|
||||
<textarea id="path" name="user_path"></textarea>
|
||||
</p>
|
||||
<p class="button">
|
||||
<button type="submit">Send your message</button>
|
||||
<label for="msg">Message:</label>
|
||||
<textarea id="msg" name="user_message"></textarea>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
|
||||
fetch("http://192.168.80.31:8080/p10.10/php/post.php", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json" // Bezpośrednie przekazanie nagłówka
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"ln": "Kowalski",
|
||||
"fn": "Jan",
|
||||
"email": "jan.kowalski@example.com",
|
||||
"subject": "Test subject",
|
||||
"path": "/path/to/photo.jpg"
|
||||
})
|
||||
})
|
||||
.then(response => {
|
||||
return response.json(); // Oczekujemy odpowiedzi w formacie JSON
|
||||
})
|
||||
.then(data => {
|
||||
console.log("Response from server:", data); // Wyświetlenie odpowiedzi z serwera
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("There was a problem with the fetch operation:", error);
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
10
php/__
10
php/__
|
@ -1,10 +0,0 @@
|
|||
curl -X POST http://192.168.80.31:8080/p10.10/php/post.php \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"ln": "Kowalski",
|
||||
"fn": "Jan",
|
||||
"email": "jan.kowalski@example.com",
|
||||
"subject": "Test subject",
|
||||
"path": "/path/to/photo.jpg"
|
||||
}'
|
||||
|
13
php/post.php
13
php/post.php
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
$con = mysqli_connect("192.168.80.31", "root", "secret", "db");
|
||||
|
||||
$data = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
$kw = "INSERT INTO Persons (LastName, FirstName, Email, Subject, Path) VALUES ('{$data['ln']}', '{$data['fn']}', '{$data['email']}', '{$data['subject']}', '{$data['path']}')";
|
||||
$ans = mysqli_query($con, $kw);
|
||||
|
||||
echo json_encode($kw);
|
||||
|
||||
?>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
curl -X POST http://192.168.80.31:8080/p10.10/php/post.php \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"ln": "Kowalski",
|
||||
"fn": "Jan",
|
||||
"email": "jan.kowalski@example.com",
|
||||
"subject": "Test subject",
|
||||
"path": "/path/to/photo.jpg"
|
||||
}'
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
Invoke-RestMethod -Uri "http://192.168.80.31:8080/p10.10/php/post.php" -Method Post -ContentType "application/json" -Body '{"ln": "Kowalski", "fn": "Jan", "email": "jan.kowalski@example.com", "subject": "Test subject", "path": "/path/to/photo.jpg"}'
|
||||
|
Binary file not shown.
14
sql/init.sql
14
sql/init.sql
|
@ -1,14 +0,0 @@
|
|||
CREATE TABLE Persons (
|
||||
PersonID int primary key auto_increment,
|
||||
LastName varchar(255),
|
||||
FirstName varchar(255),
|
||||
Email varchar(255),
|
||||
Subject varchar(255),
|
||||
Path varchar(255)
|
||||
);
|
||||
|
||||
INSERT INTO Persons (LastName, FirstName, Email, Subject, Path)
|
||||
VALUES
|
||||
('Smith', 'John', 'john.smith@example.com', 'Math', '/path/to/johnsmith'),
|
||||
('Doe', 'Jane', 'jane.doe@example.com', 'Physics', '/path/to/janedoe'),
|
||||
('Brown', 'Charlie', 'charlie.brown@example.com', 'Chemistry', '/path/to/charliebrown');
|
14
sql/sql.sql
14
sql/sql.sql
|
@ -1,14 +0,0 @@
|
|||
CREATE TABLE Persons (
|
||||
PersonID int primary key auto_increment,
|
||||
LastName varchar(255),
|
||||
FirstName varchar(255),
|
||||
Email varchar(255),
|
||||
Subject varchar(255),
|
||||
Path varchar(255)
|
||||
);
|
||||
|
||||
INSERT INTO Persons (LastName, FirstName, Email, Subject, Path)
|
||||
VALUES
|
||||
('Smith', 'John', 'john.smith@example.com', 'Math', '/path/to/johnsmith'),
|
||||
('Doe', 'Jane', 'jane.doe@example.com', 'Physics', '/path/to/janedoe'),
|
||||
('Brown', 'Charlie', 'charlie.brown@example.com', 'Chemistry', '/path/to/charliebrown');
|
Loading…
Reference in New Issue