function decline() { window.close() } function Apply() { var objName = document.getElementById("IDname"); var objEmail = document.getElementById("IDemail"); var objForm = document.getElementById("FormDemo"); if ((objName.value == "") || (objName.value == "")) alert('Please enter details in all the mandatory fields.') else if ((objEmail.value.indexOf("@") == -1) || (objEmail.value.indexOf(".") == -1)) alert('Please specify a valid email address.') else { alert("Thank you for your interest in programmexpress. A new browser window will be \n" + "opened to display the demonstration."); // Submit the form and let the PHP record the details in the database and // do all the emailing etc. The form submit takes us to the record new user // PHP script which in turn redirects us to the demo page. objForm.submit(); } }