[英]Forms, Post and submit buttons
I feel a little silly asking this but I wanted everyones opinion on it. 我觉得有点傻,但是我想要每个人的意见。
I want to submit a page, target itself, on the press of a button but carrying one piece of data with it. 我想提交一个页面,目标本身,只需按一下按钮,但随身携带一个数据。
Example: 例:
Edit | 编辑| Delete
删除
On the click on edit, I want the page to reload with $_POST['example'] === "edit"
or something. 点击编辑,我希望页面重新加载
$_POST['example'] === "edit"
或其他东西。 I don't want to use $_GET
and I don't want to use the ugly submit button. 我不想使用
$_GET
,我不想使用丑陋的提交按钮。
Any ideas? 有任何想法吗?
You should probably go ahead and use submit buttons, but use CSS to change how they look. 您应该继续使用提交按钮,但使用CSS来改变它们的外观。 For example:
例如:
<input class="aslink" type="submit" />
.aslink {
background: transparent;
border: none;
cursor: pointer;
text-decoration: underline;
}
您可以使用Ajax提交POST请求或设置提交按钮,使其看起来像链接(或您想要的任何其他内容)。
You could use the button tag: 您可以使用按钮标记:
<button type="submit">put some html</button>
You can put html tags or images in to it and style it to your hearts content. 您可以将html标签或图像放入其中,并根据您的内容设计样式。
如果要避免提交按钮,请在单击链接时创建包含要发送的数据的表单并使用JavaScript发送它。
您可以通过链接提交表格。
<a href='#' onclick='document.myform.submit()'> Edit </a>
<input class="aslink" type="submit" />
.aslink { background: transparent;
.aslink {background:transparent; border: none;
border:none; cursor: pointer;
游标:指针; text-decoration: underline;
文字装饰:下划线; }
}
ideally you would want to write the css out like this: 理想情况下,你会想要像这样编写css:
input.aslink
input.aslink
doing this will lock down those styles to ONLY being used by input tags with the appropriate class 这样做会将这些样式锁定为仅由具有适当类的输入标记使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.