<form onsubmit="return checkform();" method="post" action="add.php">写个函数判断是否为空
<script type="text/javascript"> function checkform() { if($("#pname").val()=='') { alert('姓名不能为空!'); return false; }}