-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperson-schema-generator.php
53 lines (46 loc) · 1.52 KB
/
person-schema-generator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Process the form data
$name = $_POST['name'] ?? 'N/A';
$jobTitle = $_POST['jobTitle'] ?? 'N/A';
$telephone = $_POST['telephone'] ?? 'N/A';
$email = $_POST['email'] ?? 'N/A';
$url = $_POST['url'] ?? 'N/A';
$personSchema = [
"@context" => "http://schema.org",
"@type" => "Person",
"name" => $name,
"jobTitle" => $jobTitle,
"telephone" => $telephone,
"email" => $email,
"url" => $url
];
// Set header to output as JSON-LD
header("Content-Type: application/ld+json");
echo json_encode($personSchema, JSON_PRETTY_PRINT);
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Person Schema Generator</title>
</head>
<body>
<h1>Person Schema Generator</h1>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name"><br><br>
<label for="jobTitle">Job Title:</label>
<input type="text" id="jobTitle" name="jobTitle"><br><br>
<label for="telephone">Telephone:</label>
<input type="tel" id="telephone" name="telephone"><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br><br>
<label for="url">Website URL:</label>
<input type="url" id="url" name="url"><br><br>
<button type="submit">Generate Schema</button>
</form>
</body>
</html>