rename various files and functions to add consistency
This commit is contained in:
parent
bcd41be9a8
commit
5efaae8bb3
|
@ -36,7 +36,7 @@ date_default_timezone_set('Europe/Amsterdam');
|
||||||
<h2>New entry</h2>
|
<h2>New entry</h2>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo "<form class= 'post-box p' method='POST' action='".pbinsert($con)."'>
|
echo "<form class= 'post-box p' method='POST' action='".post_demand($con)."'>
|
||||||
Title<br>
|
Title<br>
|
||||||
<input type='text' name='title' required><br>
|
<input type='text' name='title' required><br>
|
||||||
Quality<br>
|
Quality<br>
|
|
@ -34,7 +34,7 @@ date_default_timezone_set('Europe/Amsterdam');
|
||||||
<div>
|
<div>
|
||||||
<h2>Open Requests</h2>
|
<h2>Open Requests</h2>
|
||||||
<?php
|
<?php
|
||||||
get_post_titles($con);
|
get_demand_titles($con);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
include 'functions.php';
|
||||||
|
date_default_timezone_set('Europe/Amsterdam');
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<!-- enable utf-8 encoding for umlauts etc.-->
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<!-- Description of what this dose -->
|
||||||
|
<meta name ="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<!-- link to the default css file -->
|
||||||
|
<link rel="stylesheet" href="css/stylesheet.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<header>
|
||||||
|
<!-- The title begins here -->
|
||||||
|
<h1>Edit</h1>
|
||||||
|
<!-- The title ends here -->
|
||||||
|
|
||||||
|
<!-- The sidebar naviagtion begins here -->
|
||||||
|
<nav>
|
||||||
|
<?php
|
||||||
|
include 'navigation.php';
|
||||||
|
?>
|
||||||
|
</nav>
|
||||||
|
<!-- The sidebar naviagtion ends here -->
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
<!-- Edit function begins here -->
|
||||||
|
<h2>Edit Board</h2>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$userId = $_POST['userId'];
|
||||||
|
$demandId = $_POST['demandId'];
|
||||||
|
$piecesMax = $_POST['piecesMax'];
|
||||||
|
$piecesMin = $_POST['piecesMin'];
|
||||||
|
$title= $_POST['title'];
|
||||||
|
$text = $_POST['text'];
|
||||||
|
|
||||||
|
echo
|
||||||
|
"<form method='POST' action='".edit_demand($con)."'>
|
||||||
|
<input type='text' name='title' value='".$title."'><br>
|
||||||
|
<input type='hidden' name='userId' value='".$userId."'>
|
||||||
|
<input type='hidden' name='demandId' value='".$demandId."'><br /> Maximum<br/>
|
||||||
|
<input type='number' name='piecesMax' value='".$piecesMax."'> <br /> Minimum<br/>
|
||||||
|
<input type='number' name='piecesMin' value='".$piecesMin."'>
|
||||||
|
<br /> Produktbeschreibung<br/>
|
||||||
|
<textarea name='text'>".$text."</textarea><br />
|
||||||
|
<button type='submit' name='edit'>Edit</button>
|
||||||
|
</form>";
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -69,7 +69,7 @@ function get_userid ($con)
|
||||||
}
|
}
|
||||||
|
|
||||||
// A function to post a demand
|
// A function to post a demand
|
||||||
function pbinsert ($con)
|
function post_demand ($con)
|
||||||
{
|
{
|
||||||
if (isset($_POST['submit'])) {
|
if (isset($_POST['submit'])) {
|
||||||
global $con;
|
global $con;
|
||||||
|
@ -89,7 +89,7 @@ function pbinsert ($con)
|
||||||
}
|
}
|
||||||
|
|
||||||
// A function to insert the own posts from the database into the website
|
// A function to insert the own posts from the database into the website
|
||||||
function get_post_titles($con)
|
function get_demand_titles ($con)
|
||||||
{
|
{
|
||||||
global $con;
|
global $con;
|
||||||
$sql = "SELECT * FROM demands";
|
$sql = "SELECT * FROM demands";
|
||||||
|
@ -105,7 +105,7 @@ function get_post_titles($con)
|
||||||
<button type='submit' name= 'deletepost'> Delete</button>
|
<button type='submit' name= 'deletepost'> Delete</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form class= 'edit-form' method= 'POST' action='editboard.php'>
|
<form class= 'edit-form' method= 'POST' action='edit_demand.php'>
|
||||||
<input type='hidden' name='userId' value='".$row['userId']."'>
|
<input type='hidden' name='userId' value='".$row['userId']."'>
|
||||||
<input type='hidden' name='demandId' value='".$row['demandId']."'>
|
<input type='hidden' name='demandId' value='".$row['demandId']."'>
|
||||||
<input type='hidden' name='piecesMax' value='".$row['piecesMax']."'>
|
<input type='hidden' name='piecesMax' value='".$row['piecesMax']."'>
|
||||||
|
@ -120,7 +120,7 @@ function get_post_titles($con)
|
||||||
|
|
||||||
|
|
||||||
// A function to edit a demand
|
// A function to edit a demand
|
||||||
function edit_post($con)
|
function edit_demand ($con)
|
||||||
{
|
{
|
||||||
if (isset($_POST['edit'])) {
|
if (isset($_POST['edit'])) {
|
||||||
global $con;
|
global $con;
|
||||||
|
@ -142,7 +142,7 @@ function edit_post($con)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// A function to delete a post
|
// A function to delete a post
|
||||||
function delete_post($con)
|
function delete_demand($con)
|
||||||
{
|
{
|
||||||
if (isset($_POST['deletepost'])) {
|
if (isset($_POST['deletepost'])) {
|
||||||
global $con;
|
global $con;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
echo '<ul>
|
echo '<ul>
|
||||||
<li><a href="index.php">Logout</a></li>
|
<li><a href="index.php">Logout</a></li>
|
||||||
<li><a href="board.php">Board</a></li>
|
<li><a href="board.php">Board</a></li>
|
||||||
<li><a href="add_request.php">New Request</a></li>
|
<li><a href="add_demand.php">New Demand</a></li>
|
||||||
<li><a class="active" href="home.php">Home</a></li>
|
<li><a class="active" href="home.php">Home</a></li>
|
||||||
</ul>'
|
</ul>'
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue