Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript HTML表单没有提交,只是刷新页面_Javascript_Php_Html - Fatal编程技术网

Javascript HTML表单没有提交,只是刷新页面

Javascript HTML表单没有提交,只是刷新页面,javascript,php,html,Javascript,Php,Html,我有一个表单,它正在提交一个要在服务器上裁剪的图像,该图像可以从最终用户计算机上传,也可以是游戏中的一个屏幕截图,自动上传,然后重定向到自动填充图像的表单。我无法在进行游戏过程中提交表格。相反,它会刷新丢失所有数据的页面。这是一个预加载数据的测试 想为地图图像投票吗 那么您有一个屏幕截图,您认为它值得作为地图图像吗? 上传、裁剪并提交,社区将对此进行投票。 地图名称: 您的表单中有method=“post”但您在php中使用的是$\u GET。如果启用了php错误报告功能,您会发现这一点im

我有一个表单,它正在提交一个要在服务器上裁剪的图像,该图像可以从最终用户计算机上传,也可以是游戏中的一个屏幕截图,自动上传,然后重定向到自动填充图像的表单。我无法在进行游戏过程中提交表格。相反,它会刷新丢失所有数据的页面。这是一个预加载数据的测试


想为地图图像投票吗

那么您有一个屏幕截图,您认为它值得作为地图图像吗?
上传、裁剪并提交,社区将对此进行投票。

地图名称:
您的表单中有
method=“post”
但您在php中使用的是
$\u GET
。如果启用了php错误报告功能,您会发现这一点immediately@pottedmeat7它在没有参数的情况下工作正常,添加反斜杠只会在根目录中查找crop.php。@DiddleDot注意,该操作是一个不同的php文件。您必须使用$\u文件数组获取上载的文件数据。
<?php include 'header.php'; ?>
<style>
    <?php include 'styles/style.css'; ?>
    <?php include 'scripts/cropper/cropper.css' ?>
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js" type="text/javascript"></script>
<script>
    <?php include 'scripts/cropper/cropper.js'; ?>
    <?php include 'scripts/controller.js' ?>
</script>
<?php
    $_mapName = isset($_GET["mapname"]) ? $_GET["mapname"] : "";
    $_userName = isset($_GET["user"]) ? $_GET["user"] : "";
    $_uploaded = isset($_GET["uploaded"]) ? $_GET["uploaded"] : "false";
    $_image = "";
    if (strtolower($_uploaded) == "true") {
        $_image = "./images/tmp/" . $_userName . ".png";
    }
?>
<body>
<div id="float_left_static" class="border">
    Want to vote for a map image? <br>
    <a href="vote.php">Click here!</a>
</div>
<div id="float_center" class="border">
        <div id="float_center">
            <p style="text-align: center">So you have a screen shot and you thing it worthy as the maps image?<br>
                Well upload, crop, and submit it and the community will vote on it.
            </p>
            <form action="crop.php" method="post" enctype="multipart/form-data">
                <table>
                    <tr>
                        <td>
                            <label for="mapName">Map Name:</label>
                            <input type="text" name="mapName" id="mapName"
                                   value="<?php echo $_mapName; ?>" <?php echo (isset($_mapName) && $_mapName != "") ? "readonly" : ""; ?>>
                        </td>
                        <td>
                            <label for="file">Map Image:</label>
                            <input type="file" name="file" id="file" onchange="populateImage(this)">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="userName">Username:</label>
                            <input type="text" name="userName" id="userName"
                                   value="<?php echo $_userName; ?>" <?php echo (isset($_userName) && $_userName != "") ? "readonly" : ""; ?>>
                        </td>
                        <td>
                            <label for="submit">Submit:</label>
                            <input id="submit" type="submit" name="submit" value="Upload and Crop">
                        </td>
                    </tr>
                </table>
                <input type="hidden" name="x" id="x" />
                <input type="hidden" name="y" id="y" readonly/>
                <input type="hidden" name="width" id="width" />
                <input type="hidden" name="height" id="height" />
                <input type="hidden" name="uploaded" value="<?php echo strtolower($_uploaded); ?>"/>
            </form>
        </div>
    <img id="cropper" width="100%" src="<?php echo $_image; ?>"/>
    <?php
        if ($_image != "") {
            echo '<script type="text/javascript"> refreshCropper(); </script>';
        }
    ?>
</div>
</body>