2015-04-26 45 views
0

我有複選框的形式(實際上與單選按鈕,而不是複選框)。我想創建一個包含選項列表的報告。此報告應在提交表格中確認。這個怎麼做?我的代碼中還有兩個其他功能。我的形式類似於形成以下從表單生成報表確認之前提交

<form method="POST" action="add.php" onSubmit="return otherFunction();"> 
 
<?php 
 
while($linia=mysql_fetch_array($result)){ 
 
    echo "<tr><td>".$linia['Description']."</td><td><input type='radio' name='check".$i."' value='1' onClick='activeFunction(".$i.")'><input type='hidden' name='vcheck".$i."' value='".$linia['Id_description']."'></td>"; \t 
 
} 
 
<button type='submit'>Send form</button> 
 
?>

我需要這樣的工作:有人檢查一些這方面的單選按鈕,然後單擊提交那麼這個人應該看到勾選的選項,以閱讀並確認如果沒有錯誤前。他/她沒有檢查的選項之一,他希望

回答

0

我會放在函數調用上像這樣的按鈕:

<button onClick="otherFunction()">Send Form</button> 
<script> 
function otherFunction() { 
    if (confirm('Sure you want to submit the form?')) { 
     // you'd have to give you form an id like 'myform' first 
     document.getElementById('myform').submit(); 
    } 
    else { 
     // not sending the form, maybe do something else here 
    } 

} 
</script> 

那麼你的表單標籤應該是這樣的:

<form method="POST" action="add.php" id="myform"> 
+0

我需要一個選中的單選按鈕的列表,不僅窗口問我是否確認 –

+0

那麼,你已經有了你的單選按鈕列表!?那麼我可能會誤解你的問題。 然後是什麼問題? – Jeff

+0

我需要它這樣工作:有人檢查這個單選按鈕的一些,然後點擊提交,然後這個人應該看到檢查選項來閱讀它,並確認是否沒有錯誤前。他/她沒有檢查他想要的選項之一 –