php send mail help

Just as a point of personal interest, this is the code

Code:
<SCRIPT LANGUAGE=JavaScript>
 
  if (navigator.appVersion.lastIndexOf('Win') != -1) {
      dropline = "\r\n"  } else { dropline = "\n" }
function msg(form) {
document.form.Message.value = (
   '  ' + dropline + dropline
  + '----- AutoMated E-Mail Form---START----- ' + dropline
  + dropline + dropline 
  + 'Name     : ' + document.form.name.value + dropline
  + 'Phone    : ' + document.form.phone.value + dropline
  + 'Subject  : ' + document.form.subject.value + dropline
  + 'E-mail    : ' + document.form.email.value + dropline
  + 'Message: ' + document.form.message.value
  + dropline  + dropline
  + '-----AutoMated E-Mail Form----END------ ' + dropline
  + dropline + 'E-Mail Form JavaScript by:' + dropline
  + 'http://www.yuhright.co.uk' + dropline
  + dropline + dropline 
  + ' FIELD VALUES: ' + dropline
  + '  ' + dropline
);
}
// -->
</SCRIPT>

<FORM name="form" method="post" action="mailto:[email protected]?subject=Message"
 enctype="text/plain">
<INPUT type=hidden name="Message">

<FONT FACE="VERDANA, ARIAL"><B>Name:</B></FONT><P>
<INPUT type="text" size=25 name="name" onChange="msg()">



<P>
<FONT FACE="VERDANA, ARIAL"><B>Email:</B></FONT><P>
<INPUT type="text" size=25 name="email" onChange="msg()">

<P>
<FONT FACE="VERDANA, ARIAL"><B>Subject:</B></FONT><P>
<INPUT type="text" size=25 name="subject" onChange="msg()">

<P>
<FONT FACE="VERDANA, ARIAL"><B>Message:</B></FONT><P>
<TEXTAREA rows=5 cols=45 wrap="auto" name=message onChange="msg()"></TEXTAREA>

<P>
<CENTER>
<INPUT type=submit value="Send Message" onClick="msg()">
</CENTER>
</FORM>
<P>
But for the reasons above it isnt ideal. Very easy though, and most such forms arent 100% secure.
 
Thanks for everyone's help...got it sorted and working. :)

Is it possible to make it so that the form won't send if all fields aren't completed? A popup or something to show the user they've left something out.

Thank you.
 
Well naughty way to do it would be using java script validation only.

However.... What you should do it pair JS validation with some server side validation.

Look up "php form server side validation" and "javascript form validation"

I might write something later, but now I'm gonna get some grub!

You'll want SS validation as if someone disables JS they can submit bad things, and mess up your app.
 
Back
Top Bottom