Php 如何获取图像的名称标签
我在另一个表中的数据库中有一个图像显示为Php 如何获取图像的名称标签,php,html,image,post,tags,Php,Html,Image,Post,Tags,我在另一个表中的数据库中有一个图像显示为$draft['draft\u image'],我想将此数据发送到另一个表,但我遇到了一个问题,因为此代码似乎不起作用。。当我尝试单击“发布”按钮时,没有发送任何数据。我使用var\u dump显示插入的数据,但在inspect元素中没有显示任何内容。。你知道我怎样才能得到这个图像吗?这是我的草稿图像中的内容。/images/article/md.png <form method="POST" enctype="multipart/form-data
$draft['draft\u image']
,我想将此数据发送到另一个表,但我遇到了一个问题,因为此代码似乎不起作用。。当我尝试单击“发布”按钮时,没有发送任何数据。我使用var\u dump
显示插入的数据,但在inspect元素中没有显示任何内容。。你知道我怎样才能得到这个图像吗?这是我的草稿图像中的内容<代码>。/images/article/md.png
<form method="POST" enctype="multipart/form-data">
<img data-name="title_image" src="./<?= $draft['draft_image'];?>" style="margin-top:5px;" width="70%" height="55%"><br><br>
<?php
}
?>
<button type="submit" name="submit" class="btn3 btn-default">Publish</button>
</form>
if (isset($_POST['submit'])) {
$id = $session_id;
$file = $_POST['title_image'];
$ress = $db->draftpublished($id,$file);
echo $ress;
}
?>
“style=”页边距顶部:5px;“width=“70%”height=“55%”>
发表
如果(isset($_POST['submit'])){
$id=$session\u id;
$file=$\u POST['title\u image'];
$ress=$db->draftpublished($id,$file);
echo$ress;
}
?>
可以使用隐藏类型ex传递值:
<form method="POST" enctype="multipart/form-data">
<img data-name="title_image" src="./<?= $draft['draft_image'];?>" style="margin-top:5px;" width="70%" height="55%"><br><br>
<input type="hidden" name="imgsrc" value="<?= $draft['draft_image'];?>">
<?php
}
?>
<button type="submit" name="submit" class="btn3 btn-default">Publish</button>
</form>
if (isset($_POST['submit'])) {
$id = $session_id;
$file = $_POST['imgsrc'];
$ress = $db->draftpublished($id,$file);
echo $ress;
}
?>
“style=“margin top:5px;”width=“70%”height=“55%”>
不是表单元素,这是您无法使用POST请求发送它的方式。您知道如何获取$draft['draft_image']]
的数据并发布它吗?您可以使用输入类型隐藏并传递POST值您想要获取什么?$draft['draft_image']
的值?哦,我明白了。。。。我太专注了,如果我能在img上加上一个名字标签,我就忘了使用隐藏的输入
<form method="POST" enctype="multipart/form-data">
<img data-name="title_image" src="./<?= $draft['draft_image'];?>" style="margin-top:5px;" width="70%" height="55%"><br><br>
<input type="hidden" name="imgsrc" value="<?= $draft['draft_image'];?>">
<?php
}
?>
<button type="submit" name="submit" class="btn3 btn-default">Publish</button>
</form>
if (isset($_POST['submit'])) {
$id = $session_id;
$file = $_POST['imgsrc'];
$ress = $db->draftpublished($id,$file);
echo $ress;
}
?>