【发布时间】:2014-04-13 20:29:49
【问题描述】:
我正在尝试将图像链接放入表单(而不是提交按钮)。我在处理表单时无法提取图像。
这是我将图像放入表单的 php 代码...
$picture = "
<div id='photo'>
<input type='image' name='image' src='www.sampleimage.jpg'>
</div>";
<div class='formData'>
<form action='recToDb.php' method='post'>" .
$picture .
"<input type='submit' name='toDB'>
</form>
</div>";
图片以 HTML 格式上传,该部分工作正常。一旦用户满意,他们可以点击提交按钮。那时,我想将图像(或图像的来源)添加到数据库中。现在,我只是想用这段代码提取图像......
if (isset($_POST['toDB']))
{echo $_POST["image"];}
如果我执行 var_dump($_POST),图像甚至不在数组中,所以我相信图像不会进入表单,但我不知道我的问题到底是什么。
请注意,我在上面的代码中没有显示的表单中还有其他内容我没有问题提取。
【问题讨论】:
标签: php html image forms input