This commit is contained in:
Joshua Ashton
2025-03-06 23:08:52 -07:00
parent 86d501c980
commit 551abb66b5
12 changed files with 514 additions and 20 deletions
+4 -1
View File
@@ -1,2 +1,5 @@
</body>
<?php
echo '
</body>
</html>
';
+46
View File
@@ -0,0 +1,46 @@
<?php
include_once('includes/functions.php');
/*
* Creates a form from an associative array of fields.
*
* See includes/input_validation.php for the structure of a fields array.
*/
function generate_form($fields, $error)
{
$form = '
<div class="standard_box outer_shadow form_container">
<form method="' . $fields['method'] . '" action="' . $fields['action'] . '">
';
foreach ($fields as $field => $metadata) {
if ($field == 'method' || $field == 'action')
continue;
$form .= '
<div class="input_box inner_shadow">
<label for="' . $field . '">' . ucwords($metadata['label']) . '</label>
<input id="' . $field . '" name="' . $field . '" type="' . $metadata['type'] . '" placeholder="' . $metadata['placeholder'] . '">
</div>
';
}
$form .= '
<input type="submit" class="submit_button">
</form>
';
if (!empty($error)) {
$form .= '
<div class="standard_box inner_shadow error">
<p class="error">' . ucwords($error) . ' information!</p>
</div>
';
}
$form .= '
</div>
';
return $form;
}
+10 -6
View File
@@ -1,10 +1,14 @@
<?php
echo '
<!doctype html>
<html lang="en">
<head>
<title>Dummy Title</title>
<link href="css/styles.css" type="text/css" rel="stylesheet">
<script src="js/index.js"></script>
</head>
<head>
<title>Vintage Coding</title>
<link href="css/styles.css" type="text/css" rel="stylesheet">
<script src="js/index.js"></script>
</head>
<body>
<body>
';
include_once('nav.php');
+8 -8
View File
@@ -1,14 +1,14 @@
<?php
$nav = '
<nav>
<ul>
<li><a href="home.php">Home</a></li>
<li><a href="account.php">Account</a></li>
<li><a href="admin.php">Admin</a></li>
<li><a href="articles.php">Articles</a></li>
</ul>
</nav>
<nav>
<ul>
<li><a href="home.php">Home</a></li>
<li><a href="account.php">Account</a></li>
<li><a href="admin.php">Admin</a></li>
<li><a href="articles.php">Articles</a></li>
</ul>
</nav>
';
echo $nav;