简体   繁体   English

具有Java验证和HTML脚本的HTML表单,该脚本通过电子邮件将表单详细信息发送给网站管理员

[英]HTML form with Javascript validation and PHP script which sends form details to webmaster by e-mail

Complete newbie looking for some guidance. 完成新手寻找一些指导。 Will be very grateful if someone could help me out! 如果有人可以帮助我,将不胜感激! Just want to confirm that the below is possible or if there is a better alternative, or I'm blatantly missing something!? 只是想确认是否可以进行以下操作,或者是否有更好的替代方法,或者我公然缺少了某些东西!

So, I'm developing a site with a simple form - it will take the user's name, email address, contact number and a message. 因此,我正在开发一个具有简单表单的网站-它将使用用户名,电子邮件地址,联系电话和消息。

So as far as I understand I can do the following: 据我了解,我可以执行以下操作:

1.Write the form in HTML and style with CSS. 1.使用CSS用HTML和样式编写表单。 2.Validate the form client side with Javascript 3.Use PHP to validate server side incase user has Javascript disabled. 2.使用Javascript验证表单客户端。3.如果用户禁用了Javascript,则使用PHP验证服务器端。 4.Use PHP mailer to send the details to an email address where the site will be hosted. 4.使用PHP邮件程序将详细信息发送到将要托管该站点的电子邮件地址。 5.On page error or success message for the user to see. 5.页面错误或成功消息供用户查看。

Would really appreciate it if you could recommend resources which will guide me through the process. 如果您能推荐一些可以指导我完成该过程的资源,将不胜感激。

Thanks a million! 太感谢了!

Drop the PHP side of things, and use this pre-made secure script NMS Formmail . 放下PHP的一面,并使用此预制的安全脚本NMS Formmail

There's no validation on that side, but I don't think you'll have to worry about it much. 那边没有验证,但我认为您不必为此担心。 Worst case you'll get an incomplete email that you just have to toss. 最坏的情况是,您将收到一封不完整的电子邮件,您只需要扔掉它即可。

JavaScript validation: http://webcheatsheet.com/javascript/form_validation.php If those functions don't work, just look around, there are plenty of other examples. JavaScript验证: http : //webcheatsheet.com/javascript/form_validation.php如果这些功能不起作用,请环顾四周,还有许多其他示例。

Now all you have left is the HTML and CSS. 现在剩下的就是HTML和CSS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM