我有一个表单,它在chrome中可以完美工作,但在例如中根本无法工作
实际表单的代码为:
<div id="launch">
<form id="form1" name="form1" method="post" action="" >
<input type="image" src="images/transparent.png" width="100" height="100" name="Launch" id="Launch" value="insertvaluehere" />
</form>
</div>
当按下表单时,我使用if语句来执行代码:
if (($_POST['Launch']) && ($available1 == 0))
{
//Code for what is done.
}
我们将非常感谢您的帮助。
您可以将其更改为
<button type="submit" name="launch" id="Launch">Submit</button>
然后使用进行样式设置
#Launch{
background-image:url(images/transparent.png);
width:100px;
height:100px;
dislay:block;
border:none;
color:transparent;
background-color:none;
cursor:pointer;
}
更改:
if ($_POST)
{
//execute
}
输入类型的图像通常不提交值,而是提交用户点击图像的坐标(通常用作图像地图)。
如果你致力于使用图片提交,你有两个主要选项:
- 常规提交类型
<input>
,其中包含一个具有所需值的隐藏字段(可以使用CSS将提交样式设置为图像) <button>