以下代码将数据上传到 MySQL,但我想添加一个浏览按钮以在 MySQL 中上传图像。
我怎样才能做到这一点?
<form action='submiturl.php' method='POST'>
<font face='sans-serif' size='5'>
<center>
<span class="style2">Please fill out all fields to submit your Keyword.</span><br>
<br>
<span class="style2">Word Name:</span><br>
<input type='text' size='50' name='title'><br><br>
<span class="style2">Keywords:</span><br><input type='text' size='50' name='keywords'><br>
<span class="style2"><br>
Description</span><br><input name='description' type='text' value="" size='50' maxlength='200'>
<br><br>
<input type='submit' name='submit' value='Submit URL'>
</form>
<br><a href='index.php' class="style2">Go Back</a></HTML>
<?php
// Language file in UTF-8
$submit = $_POST['submit'];
$title = $_POST['title'];
$keywords = $_POST['keywords'];
$description = $_POST['description'];
$connect = mysql_connect("localhost","123_search","password");
mysql_select_db("123_search");
if (!$title||!$keywords||!$description)
{
die ("<center>Please fill in all fields.</center>");
}
else
if ($submit)
{
mysql_query("INSERT INTO searchengine VALUES('','$title','$keywords','$description')");
echo "<center>KeyWord Submitted!</center>";
}
else
echo "<center>Please fill in all fields.</center>";
?>