Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by ceh2624

  1. I hope to deliver more help than I receive.

  2. Hello, I thought I'd suggest an alternative solution for you. This is based on the assumption that you are start with a form on a page written in HTML with the action set to "your/phpPage.php". You might try checking for filled in fields before the form is submitted. I am also assuming this is done with a button with no type attribute of an input of type "submit". In your HTML, for your push button use this: <button type="button" onclick="example">Send</button> The type makes the button not submit when clicked. Instead, you will check contents of the form before submitting it. You will do this with the following javascript written within your HTML page: function example(){ if( document.formNme.name == ""|| document.formNme.email == ""|| document.formNme.msg == "") { alert("Please fill in the missing information."); if(document.formNme.name == ""){document.formName.name.focus();} if(document.formNme.email == ""){document.formName.email.focus();} if(document.formNme.msg == ""){document.formName.msg.focus();} }else{ document.formNme.submit(); }} The if part of this functions checks for empty fields in the form. If true (an empty field is found), it tells the user something is missing then gives focus to the firse empty. If false (the form is all filled in), it submits the form to whatever the form's action attribute wants. This way your PHP page never sees any empty field in the first place. I hope this helps.
  • Create New...