Remove the amounts and text fields from the board view.

The board view should provide an overview over the available
requests for further selection.
This commit is contained in:
Andreas Zweili 2017-02-20 21:12:41 +01:00
parent 4871de62d3
commit c407495893
3 changed files with 8 additions and 8 deletions

View File

@ -34,7 +34,7 @@ date_default_timezone_set('Europe/Amsterdam');
<div>
<h2>Open Requests</h2>
<?php
pbget($con);
get_post_titles($con);
?>
</div>
</body>

View File

@ -38,16 +38,16 @@ date_default_timezone_set('Europe/Amsterdam');
$demandId = $_POST['demandId'];
$piecesMax = $_POST['piecesMax'];
$piecesMin = $_POST['piecesMin'];
$date = $_POST['date'];
$title= $_POST['title'];
$text = $_POST['text'];
echo
"<form method='POST' action='".editpost($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."'>
<input type='hidden' name='date' value='".$date."'>
<br /> Produktbeschreibung<br/>
<textarea name='text'>".$text."</textarea><br />
<button type='submit' name='edit'>Edit</button>

View File

@ -89,17 +89,15 @@ function pbinsert ($con)
}
// A function to insert the own posts from the database into the website
function pbget($con)
function get_post_titles($con)
{
global $con;
$sql = "SELECT * FROM demands";
$result = mysqli_query($con, $sql);
while ($row = $result->fetch_assoc()) {
echo "<div class='post-box'><p>";
echo "<strong>" . $row['demandTitle'] . "</strong>" . "<br>";
echo $row['date'] . "<br>";
echo $row['demandText'] ."<br>" , "<br /> Maximum<br/>";
echo $row['piecesMax'] ."<br /> Minimum<br/>";
echo $row['piecesMin'];
echo "</p>
<form class= 'delete-form' method= 'POST' action='".deletepost($con)."'>
<input type='hidden' name='demandId' value='".$row['demandId']."'>
@ -111,7 +109,7 @@ function pbget($con)
<input type='hidden' name='demandId' value='".$row['demandId']."'>
<input type='hidden' name='piecesMax' value='".$row['piecesMax']."'>
<input type='hidden' name='piecesMin' value='".$row['piecesMin']."'>
<input type='hidden' name='date' value='".$row['date']."'>
<input type='hidden' name='title' value='".$row['demandTitle']."'>
<input type='hidden' name='text' value='".$row['demandText']."'>
<button>Edit</button>
</form>
@ -128,12 +126,14 @@ function editpost($con)
$demandId = $_POST['demandId'];
$piecesMax = $_POST['piecesMax'];
$piecesMin = $_POST['piecesMin'];
$title = $_POST['title'];
$text = $_POST['text'];
// Inserts Updates Database
$sql = "UPDATE demands
SET piecesMax='$piecesMax',
piecesMin='$piecesMin',
demandTitle='$title',
demandText='$text'
WHERE demandId='$demandId'";
$result = mysqli_query($con, $sql) or die(mysqli_error($con));