我无法将数据存储在 MySQL 数据库中。url1 数据 -> 未转发到 u1.php。
我无法通过这个。在使用虚拟阀在 u1.php 上运行此查询时,它是完美的:
mysql_query("UPDATE admins SET url1 = '1234568' WHERE id = '1'");
当我检查数据库时,上面的值很完美,但是当我尝试表单数据时,url1 不起作用。
<form action="u1.php" method="post" enctype="multipart/form-data">
<label for="file">Select The File:</label>
<input type="file" name="file" id="file">
Enter Ad Url :<input type="text" name="url1" id="url1" placeholder="Please Enter Ad Url" width: 500px;> <br><br>
<input type="submit" name="submit" value="Submit">
</form>
u1.php 文件
<?php
mysql_connect("localhost","root","");
mysql_select_db("apphp");
mysql_query("UPDATE admins SET url1 = '$url1' WHERE id = '1'");
$allowedExts = array("gif", "jpeg", "jpg", "png");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/x-png")
|| ($_FILES["file"]["type"] == "image/png"))
&& ($_FILES["file"]["size"] < 350000)
&& in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br>";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br>";
echo "Type: " . $_FILES["file"]["type"] . "<br>";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
move_uploaded_file($_FILES["file"]["tmp_name"], "images/h1.jpg");
echo "Stored in: " . "images/" . $_FILES["file"]["name"];
}
}
else
{
echo "Invalid file";
}
?>