後,我有HTML表單,當點擊提交後,提交表單數據發送到同一php
page.But我們刷新頁面網頁瀏覽器顯示重新提交dialog.How它的停止形態在頁面刷新時提交。提交HTML表單如何停止形式resubmision當頁面刷新
我的HTML代碼:index.php文件
<form id="cfrm" method="post" action=".">
<label>If you don't like this colors you can suggest it from here by selecting or copy and paste </label><input class="color" type="text" name="color1" placeholder="Color 1:ex #AAA" required=""/>
<input class="color" type="text" name="color2" placeholder="Color 1:ex #CFC" required=""/>
<input type="submit" id="click" value="Set Colors" name="btnSubmit" />
</form>
PHP代碼(同一頁):的index.php
<?php
if (isset($_POST["btnSubmit"])) {
$c1 = isset($_POST['color1']) ? $_POST['color1'] : '';
$c2 = isset($_POST['color2']) ? $_POST['color2'] : '';
//and do some task here
}
?>
我覺得同樣的問題:http://stackoverflow.com/questions/19346762/how-to-prevent-page-redirection-refresh-after-form-submit-while-preserving-file – Eddie
我的表單操作本身。 – Elshan
使用PHP頭位置 –