Example #1
0
} else {
    $sql = "SELECT * FROM deliverer_offer WHERE ID = '" . $_REQUEST['id'] . "'";
}
$db_erg = mysqli_query($db_link, $sql);
$count = 0;
$ErrMessage = "";
$ErrCounter = 0;
while ($zeile = mysqli_fetch_array($db_erg, MYSQL_ASSOC)) {
    $offerer = $zeile['offerer'];
    $eMail = $zeile['eMail'];
    $startCountry = $zeile['startCountry'];
    $startVillage = $zeile['startVillage'];
    $destinationCountry = $zeile['destinationCountry'];
    $destinationVillage = $zeile['destinationVillage'];
    $startDate = reformDatetoNormal($zeile['startDate']);
    $endDate = reformDatetoNormal($zeile['endDate']);
    $infoField = $zeile['textField'];
    //Sorgt für korrekte Zeilenumbrüche
    $infoField = preg_replace("/\r\n|\n\r|\r|\n/", "<br>", $infoField);
    if ($_REQUEST['typ'] == "orga") {
        $contact = $zeile['contact'];
    }
    $count++;
}
//Wenn falsche ID
if ($count == 0) {
    $ErrMessage = "Dieses Angebot exestiert nicht.";
    $ErrCounter++;
}
//ID in Ländernamen
$sql = "SELECT * FROM `countries`";
$id = -1;
$counter = 0;
$test = $db->query($statement);
$test->fetch();
foreach ($iter = $db->query($statement) as $row) {
    //Creates a loop to loop through results
    if ($id != htmlspecialchars($row['id'])) {
        $id = htmlspecialchars($row['id']);
        echo "<form onSubmit=\"return\" action=\"" . htmlspecialchars($_SERVER["PHP_SELF"]) . "\" method=\"post\">";
        echo "<tr align=\"left\">\n";
        echo "<td>" . htmlspecialchars($row['offerer']) . "</td>\n";
        echo "<td>" . htmlspecialchars($row['startCountry']) . "</td>\n";
        echo "<td>" . htmlspecialchars($row['startVillage']) . "</td>\n";
        echo "<td>" . htmlspecialchars($row['destCountry']) . "</td>\n";
        echo "<td>" . htmlspecialchars($row['destinationVillage']) . "</td>\n";
        echo "<td>" . reformDatetoNormal(htmlspecialchars($row['startDate'])) . "</td>\n";
        echo "<td>";
        do {
            echo htmlspecialchars($row['pr']);
            if (($temp = $test->fetchColumn()) == $id) {
                $row = $iter->fetch();
                echo ", ";
            } else {
                break;
            }
        } while (true);
        echo "</td>\n";
        echo "<td>" . "<a href=\"/helping_supplies/AngebotEditieren/edit_Offer_Deliver_HTML.php?id={$id}\">Editieren</a></td>\n";
        echo "<td>";
        echo "<input type=\"submit\" value=\"Deaktivieren\" name=\"deactivate\">";
        echo "</td>\n";
} else {
    echo $startDate;
}
?>
>
                <span class="error"> <?php 
echo $startDateErr;
?>
</span>
            </p>
            
            Das Enddatum: 
            <p><input type="date" name="endDate" required="required" value=
                <?php 
if (!isset($_POST['endDate'])) {
    echo reformDatetoNormal(getColumnData($id, 'endDate'));
} else {
    echo $endDate;
}
?>
>
                <span class="error"> <?php 
echo $endDateErr;
?>
</span>
            </p>
            </div>
            
            <div class="columns five">
            Welches Produkt: