我有一个表单,提交要在服务器上裁剪的图像,图像可以从最终用户计算机上传,也可以是游戏中自动上传的截图,然后重定向到表单自动填充他们的图像。在进入游戏路线时我无法提交表格。相反,它会刷新丢失所有数据的页面。这是一个预加载数据的测试。 Click Me!
<?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>