在此服务器上找不到请求的URL /edit.php

时间:2017-05-30 17:17:17

标签: php html

我刚刚收到此错误。它适用于localhost。有任何想法吗? 关于如何谷歌这个错误的任何建议也会有很多帮助,因为我不确定问题可能在哪里。

  

"在此服务器上找不到请求的URL /edit.php。"

<?php
include ('includes/connection.php');
include ('includes/functions.php');
include ('includes/header.php');

$jobId  = $_GET["id"];
$query  = "SELECT * FROM Freight, WHERE id = '$jobId'";
$result = mysqli_query($connection, $query);

if (mysqli_num_rows($result) > 0) {
    while ($row = mysqli_fetch_assoc($result)) {
        $jobArrival            = $row["Arrival"];
        $jobDeparture          = $row["Departure"];
        $jobClient             = $row["Client"];
        $jobAirportOfDeparture = $row["AirportOfDeparture"];
        $jobAirportOfArrival   = $row["AirportOfArrival"];
        $jobAdditionalInfo     = $row["AdditionalInfo"];
        $jobBoxType            = $row["BoxType"];
        $jobTemp               = $row["Temp"];

        // prideti is dezes table
        // $pavadinimas           = $row["pavadinimas"];
        // $likutis               = $row["likutis"];

        if (isset($_POST['update'])) {
            $jobArrival            = validateFormData($_POST['jobArrival']);
            $jobDeparture          = validateFormData($_POST['jobDeparture']);
            $jobClient             = validateFormData($_POST['jobClient']);
            $jobAirportOfDeparture = validateFormData($_POST['jobAirportOfDeparture']);
            $jobAirportOfArrival   = validateFormData($_POST['jobAirportOfArrival']);
            $jobAdditionalInfo     = validateFormData($_POST['jobAdditionalInfo']);
            $jobBoxType            = validateFormData($_POST['jobBoxType']);
            $jobTemp               = validateFormData($_POST['jobTemp']);
            $query                 = "UPDATE Freight SET Arrival            = '$jobArrival',
                                                         Departure          = '$jobDeparture',
                                                         Client             = '$jobClient',
                                                         AirportOfDeparture = '$jobAirportOfDeparture',
                                                         AirportOfArrival   = '$jobAirportOfArrival',
                                                         AdditionalInfo     = '$jobAdditionalInfo',
                                                         BoxType            = '$jobBoxType',
                                                         Temp               = '$jobTemp'
                                                     WHERE id = '$jobId'";
            $result = mysqli_query($connection, $query);
            if ($result) {
                header("Location: formdisplay.php");
            } else {
                "Klaida" . mysqli_error($connection);
            }
        }
    }
}
else {
    echo "Nera irasu!!!!!!!!!!!!!!";
}

if (isset($_POST['istrinti'])) {
    $query = "DELETE FROM Freight WHERE id ='$jobId'";
    $result = mysqli_query($connection, $query);
    if ($result) {
        header("Location: formdisplay.php?alert=deleted");
    }
    else {
        echo "Error" . mysqli_error($connection);
    }
}

mysqli_close($connection);
?>

<h1> Iraso koregavimas</h1>
<table>
    <tr>
        <td>Arrival</td>
        <td>Departure</td>
        <td>Client</td>
        <td>Airport Of Departure</td>
        <td>Airport Of Arrival</td>
        <td>Additional Info</td>
        <td>Box Type</td>
        <td>Temp</td>
    </tr>
    <tr>
        <form method="POST" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>?id=<?php echo $jobId; ?>">
            <td>
                <input  type    = "text"
                        value   = "<?php echo $jobArrival ?>"
                        name    = "jobArrival">
            </td>
            <td>
                <input  type    = "text"
                        value   = "<?php echo $jobDeparture ?>"
                        name    = "jobDeparture">
            </td>
            <td>
                <input  type    = "text"
                        value   = "<?php echo $jobClient ?>"
                        name    = "jobClient">
            </td>
            <td>
                <input  type    = "text"
                        value   = "<?php echo $jobAirportOfDeparture ?>"
                        name    = "jobAirportOfDeparture">
            </td>
            <td>
                <input  type    = "text"
                        value   = "<?php echo $jobAirportOfArrival ?>"
                        name    = "jobAirportOfArrival">
            </td>
            <td>
                <input  type    = "text"
                        value   = "<?php echo $jobAdditionalInfo ?>"
                        name    = "jobAdditionalInfo">
            </td>
            <td>
                <input  type    = "text"
                        value   = "<?php echo $jobBoxType ?>"
                        name    = "jobBoxType">
            </td>
            <td>
                <input  type    = "text"
                        value   = "<?php echo $jobTemp ?>"
                        name    = "jobTemp">
            </td>
            <td>
                <input  type    = "submit"
                        name    = "update"
                        value   = "update"
                        href    = "formdisplay.php"></td>
            <td>
                <input  type    ="submit"
                        name    ="istrinti"
                        value   ="istrinti"
                        href    ="formdisplay.php">
            </td>
        </form>
    </tr>
</table>

2 个答案:

答案 0 :(得分:0)

此处的关键可能是/中的/edit.php。请尝试仅包含edit.php,或者更直接地将其转到目录。

祝你好运!

答案 1 :(得分:0)

问题已解决。第143行问题,错误空间很少。 花了我一个星期才找到它:) 代码必须如下<form method="POST" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>?id=<?php echo $jobId ?>">