【发布时间】:2015-03-10 21:01:26
【问题描述】:
我这里有一种情况:我有以下表格:
<form action="sample.php" id="searchform" method="post">
<input type="text" id="key_words" name="key_words" value="<?php echo isset($_POST['key_words']) ? $_POST['key_words'] : '' ?>"style="width:377px;">
<input type="text" name="minimum_price" value="<?php echo isset($_POST['minimum_price']) ? $_POST['minimum_price'] : '' ?>">
<input type="text" name="maximum_price" value="<?php echo isset($_POST['maximum_price']) ? $_POST['maximum_price'] : '' ?>">
我在 value 中使用 php 脚本,因为我需要将文本框中的值保持不变。所以,现在我需要在单击按钮时清除文本框中的值:
<button type="reset" value="clear" onclick="clearform()">Clear</button>
我尝试了几件事,但都失败了。请帮忙? JavaScript 也可以用于 clearform() 方法。
【问题讨论】:
-
对这个特性使用基本的 html。在 标签结束之前插入 。这将清除
-
@unixmiah 这不起作用,因为我将值回显到文本字段中。
标签: php html post forms http-post