Skip to content

Instantly share code, notes, and snippets.

@JarvusChen
Last active March 26, 2016 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JarvusChen/8a71e4d611d6fde1c52f to your computer and use it in GitHub Desktop.
Save JarvusChen/8a71e4d611d6fde1c52f to your computer and use it in GitHub Desktop.
PHP form DEMO
<script type="text/javascript">
function checkFunc(){
var f = document.form.check;
var b = document.form.YourName;
if (b.value == ""){
alert("請填寫姓名")
return false;
}
if (f.checked){
}else{
alert("請打勾")
return false;
}
if (b.value != null && f.checked){
return true;
}
}
</script>
<form name="form" method="post" action="finished.php" onsubmit="return checkFunc();">
<input style="width:100px" type="text" name="YourName">
<input type="checkbox" name="check">
<input type="submit" name="submit" value="送出">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment