remove some unnecessary parts

This commit is contained in:
Andreas Zweili 2017-02-20 22:39:43 +01:00
parent 2097a1f25e
commit e06029066d
3 changed files with 13 additions and 15 deletions

View File

@ -34,9 +34,7 @@ date_default_timezone_set('Europe/Amsterdam');
<!-- The Post function begins here -->
<div>
<h2>New entry</h2>
<?php
echo "<form class= 'post-box p' method='POST' action='".post_demand($con)."'>
<form class= 'post-box p' method='POST' action=''>
Title<br>
<input type='text' name='title' required><br>
Quality<br>
@ -55,8 +53,9 @@ date_default_timezone_set('Europe/Amsterdam');
<textarea rows='6' cols='40' name='text' required></textarea><br>
<button type='submit' name='submit'>SUBMIT</button>
</form>
";
?>
</div>
<?php
post_demand();
?>
</body>
</html>

View File

@ -41,8 +41,7 @@ date_default_timezone_set('Europe/Amsterdam');
$title= $_POST['title'];
$text = $_POST['text'];
echo
"<form class= 'post-box p' method='POST' action='".edit_demand($con)."'>
echo "<form class= 'post-box p' method='POST' action='".edit_demand()."'>
<input type='text' name='title' value='".$title."'><br>
<input type='hidden' name='userId' value='".$userId."'>
<input type='hidden' name='demandId' value='".$demandId."'><br />Maximum required pieces<br/>

View File

@ -57,7 +57,7 @@ function register ()
}
//A function to read out the userId of the current user
function get_userid ($con)
function get_userid ()
{
global $con;
session_start();
@ -69,11 +69,11 @@ function get_userid ($con)
}
// A function to post a demand
function post_demand ($con)
function post_demand ()
{
if (isset($_POST['submit'])) {
global $con;
$userId = get_userid($con);
$userId = get_userid();
$piecesMax = $_POST['piecesMax'];
$piecesMin = $_POST['piecesMin'];
$qualityId = $_POST['quality'];
@ -95,7 +95,7 @@ function post_demand ($con)
}
// A function to insert the own posts from the database into the website
function get_demand_titles ($con)
function get_demand_titles ()
{
global $con;
$sql = "SELECT * FROM demands";
@ -106,7 +106,7 @@ function get_demand_titles ($con)
echo $row['date'] . "<br>";
echo "</p>
<form class= 'delete-form' method= 'POST'
action='".delete_demand($con)."'>
action='".delete_demand()."'>
<input type='hidden' name='demandId' value='".$row['demandId']."'>
<button type='submit' name= 'deletepost'> Delete</button>
</form>
@ -126,7 +126,7 @@ function get_demand_titles ($con)
// A function to edit a demand
function edit_demand ($con)
function edit_demand ()
{
if (isset($_POST['edit'])) {
global $con;
@ -154,7 +154,7 @@ function edit_demand ($con)
}
}
// A function to delete a post
function delete_demand($con)
function delete_demand()
{
if (isset($_POST['deletepost'])) {
global $con;
@ -166,4 +166,4 @@ function delete_demand($con)
header('Location: board.php');
}
}
?>
?>