remove some unnecessary parts
This commit is contained in:
parent
2097a1f25e
commit
e06029066d
|
@ -34,9 +34,7 @@ date_default_timezone_set('Europe/Amsterdam');
|
||||||
<!-- The Post function begins here -->
|
<!-- The Post function begins here -->
|
||||||
<div>
|
<div>
|
||||||
<h2>New entry</h2>
|
<h2>New entry</h2>
|
||||||
|
<form class= 'post-box p' method='POST' action=''>
|
||||||
<?php
|
|
||||||
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>
|
||||||
|
@ -55,8 +53,9 @@ date_default_timezone_set('Europe/Amsterdam');
|
||||||
<textarea rows='6' cols='40' name='text' required></textarea><br>
|
<textarea rows='6' cols='40' name='text' required></textarea><br>
|
||||||
<button type='submit' name='submit'>SUBMIT</button>
|
<button type='submit' name='submit'>SUBMIT</button>
|
||||||
</form>
|
</form>
|
||||||
";
|
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
|
post_demand();
|
||||||
|
?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -41,8 +41,7 @@ date_default_timezone_set('Europe/Amsterdam');
|
||||||
$title= $_POST['title'];
|
$title= $_POST['title'];
|
||||||
$text = $_POST['text'];
|
$text = $_POST['text'];
|
||||||
|
|
||||||
echo
|
echo "<form class= 'post-box p' method='POST' action='".edit_demand()."'>
|
||||||
"<form class= 'post-box p' method='POST' action='".edit_demand($con)."'>
|
|
||||||
<input type='text' name='title' value='".$title."'><br>
|
<input type='text' name='title' value='".$title."'><br>
|
||||||
<input type='hidden' name='userId' value='".$userId."'>
|
<input type='hidden' name='userId' value='".$userId."'>
|
||||||
<input type='hidden' name='demandId' value='".$demandId."'><br />Maximum required pieces<br/>
|
<input type='hidden' name='demandId' value='".$demandId."'><br />Maximum required pieces<br/>
|
||||||
|
|
|
@ -57,7 +57,7 @@ function register ()
|
||||||
}
|
}
|
||||||
|
|
||||||
//A function to read out the userId of the current user
|
//A function to read out the userId of the current user
|
||||||
function get_userid ($con)
|
function get_userid ()
|
||||||
{
|
{
|
||||||
global $con;
|
global $con;
|
||||||
session_start();
|
session_start();
|
||||||
|
@ -69,11 +69,11 @@ function get_userid ($con)
|
||||||
}
|
}
|
||||||
|
|
||||||
// A function to post a demand
|
// A function to post a demand
|
||||||
function post_demand ($con)
|
function post_demand ()
|
||||||
{
|
{
|
||||||
if (isset($_POST['submit'])) {
|
if (isset($_POST['submit'])) {
|
||||||
global $con;
|
global $con;
|
||||||
$userId = get_userid($con);
|
$userId = get_userid();
|
||||||
$piecesMax = $_POST['piecesMax'];
|
$piecesMax = $_POST['piecesMax'];
|
||||||
$piecesMin = $_POST['piecesMin'];
|
$piecesMin = $_POST['piecesMin'];
|
||||||
$qualityId = $_POST['quality'];
|
$qualityId = $_POST['quality'];
|
||||||
|
@ -95,7 +95,7 @@ function post_demand ($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_demand_titles ($con)
|
function get_demand_titles ()
|
||||||
{
|
{
|
||||||
global $con;
|
global $con;
|
||||||
$sql = "SELECT * FROM demands";
|
$sql = "SELECT * FROM demands";
|
||||||
|
@ -106,7 +106,7 @@ function get_demand_titles ($con)
|
||||||
echo $row['date'] . "<br>";
|
echo $row['date'] . "<br>";
|
||||||
echo "</p>
|
echo "</p>
|
||||||
<form class= 'delete-form' method= 'POST'
|
<form class= 'delete-form' method= 'POST'
|
||||||
action='".delete_demand($con)."'>
|
action='".delete_demand()."'>
|
||||||
<input type='hidden' name='demandId' value='".$row['demandId']."'>
|
<input type='hidden' name='demandId' value='".$row['demandId']."'>
|
||||||
<button type='submit' name= 'deletepost'> Delete</button>
|
<button type='submit' name= 'deletepost'> Delete</button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -126,7 +126,7 @@ function get_demand_titles ($con)
|
||||||
|
|
||||||
|
|
||||||
// A function to edit a demand
|
// A function to edit a demand
|
||||||
function edit_demand ($con)
|
function edit_demand ()
|
||||||
{
|
{
|
||||||
if (isset($_POST['edit'])) {
|
if (isset($_POST['edit'])) {
|
||||||
global $con;
|
global $con;
|
||||||
|
@ -154,7 +154,7 @@ function edit_demand ($con)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// A function to delete a post
|
// A function to delete a post
|
||||||
function delete_demand($con)
|
function delete_demand()
|
||||||
{
|
{
|
||||||
if (isset($_POST['deletepost'])) {
|
if (isset($_POST['deletepost'])) {
|
||||||
global $con;
|
global $con;
|
||||||
|
@ -166,4 +166,4 @@ function delete_demand($con)
|
||||||
header('Location: board.php');
|
header('Location: board.php');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue