我的PHP没有工作,但没有返回任何错误

时间:2017-01-15 14:38:13

标签: php html

无论出于何种原因,我的PHP似乎没有做任何事情? 我没有得到错误或任何它什么都不做的事情。

这是我的代码:我试图放一个标题,但它没有做任何事情 我使用xampp并使用http://使用file://访问它 这是我的PHP代码。

<?php 
if(!(isset($_POST['submit']))) {
    session_start();
    $firstimgsrc = $_POST['firstimgsrc'];   
    if ($firstimgsrc == "") {
        echo "w/e";
    } else {
        $_SESSION['firstimgsrc'] = $firstimgsrc;
    }
    $secondimgsrc = $_POST['secondimgsrc'];
    if ($secondimgsrc == "") {
        echo "w/e"; } else {
        $_SESSION['secondimgsrc'] = $secondimgsrc;

    }
    $thirdimgsrc = $_POST['thirdimgsrc'];

    if ($thirdimgsrc == "") {
        echo "w/e";
    } else {
    $_SESSION['thirdimgsrc'] = $thirdimgsrc;
}
    $forthimgsrc = $_POST['forthimgsrc'];
    if ($forthimgsrc == "") {
        echo "w/e";

    } else {
        $_SESSION['forthimgsrc'] = $forthimgsrc;
    }
    header("Location: ../egamingtv.php");
}

?>

和部分HTML代码:

<form method="post" action="changecontent.php">
                <div class="champs">

                    <img id="firstimg" src="">
                    <input name="firstimgsrc">
                    <input id="firstchamp" value="" style="background-color: transparent;border: 0px;" disabled="yes">
                    <input id="firstdate" style="background-color: transparent;border: 0px;"  value="" disabled="yes"></div>
                <div class="champs">
                    <img id="secondimg" src="">
                    <input name="secondimgsrc">
                    <input id="secondchamp" style="background-color: transparent;border: 0px;"  value="" disabled="yes">
                    <input id="seconddate" style="background-color: transparent;border: 0px;" value="" disabled="yes">
                </div>
                <div class="champs">
                    <img id="thirdimg" src="">
                    <input name="thirdimgsrc">
                    <input id="thirdchamp" style="background-color: transparent;border: 0px;"  value="" disabled="yes">
                    <input id="thirddate" style="background-color: transparent;border: 0px;"  value="" disabled="yes"></div>
                <div class="champs">
                    <img id="forthimg" src="">
                    <input name="forthimgsrc">
                    <input id="forthchamp" style="background-color: transparent;border: 0px;"  value="" disabled="yes">
                    <input id="forthdate" style="background-color: transparent;border: 0px;"  value="" disabled="yes">
                </div>
                <div>
                    <input type="submit" value="submit" name="submit" >
                </div>
            </form>

1 个答案:

答案 0 :(得分:3)

在此处查看此行,

if(!(isset($_POST['submit']))) { 
   ^ see this NOT sign

if语句应如下所示:

if(isset($_POST['submit'])) {