7 Replies - 1671 Views - Last Post: 02 July 2010 - 10:19 AM

#1 openoutcome   User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 51
  • Joined: 06-November 09

Form validation and submission?

Posted 01 July 2010 - 01:27 PM

Hi there,

First I want to say thanks to all you helpers so far, I've asked a few questions in the past weeks. You guys are lifesavers.

My current question:

So I have made a form where visitors can submit their ideas to me. The form can be seen here:

http://www.chargefre...com/submit.html

I have the email address that I wish the form submissions to go through, don't think I should post it here, so its -

"blank"@chargefreesoftware.com

Now my code book doesn't explain how to send this information to that email, only how to make forms. How can I do this? And make sure that only TXT information is able to go through. Is there an online guide that will help me out?

Is This A Good Question/Topic? 0
  • +

Replies To: Form validation and submission?

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5239
  • View blog
  • Posts: 14,033
  • Joined: 18-April 07

Re: Form validation and submission?

Posted 01 July 2010 - 01:37 PM

Well information in forms is generally sent as text unless of course you have a file input field in your form. A form's information is specified by using the "action" attribute in the form tag. Now normally people direct the form to be submitted to a script that can validate the form and if all is good, call a mailing function to then mail the information to them. For instance PHP has mailing functions and the form can be submitted to a PHP script you write by specifying it in the action attribute like this...

<form method="POST" action="myphpscript.php">



You will see this is similar to submitting forms to ASP, CGI or Cold Fusion. What you also can do is specify an email address in the action attribute. Now generally I advise against this because it will skip any kind of validation you could do on a server side etc.

<form method="POST" action="mailto:[email protected]">



But if you are only doing HTML in your site then this might be your only real option. So try that and if it meets your needs fine, but again I strongly suggest you get some kind of host that supports a server-side language, write a script, and submit your form to the script for validation. :)
Was This Post Helpful? 1
  • +
  • -

#3 openoutcome   User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 51
  • Joined: 06-November 09

Re: Form validation and submission?

Posted 01 July 2010 - 01:48 PM

Thanks for that! Good information there. Yes, I agree the first option would be better, wherever I see forms I view how they've coded it, and it's always submitted to a .php file for validation. Safer.

I think for right now, I'll do the latter, and once I learn how to code php, I can change that over. The host I have does support php and ajax, and whatever else, I simply don't know how to code it yet :D

I will learn, but for right now, thanks!

Oh - also, Dunno if you looked but on my form I have required fields marked with asterisks *. This is just text though, and you can still submit the form without typing in the "required" fields. What is the fashion to stop visitors from submitting unless they fill out the required? Sometimes I see it pop up as a Javascrpt message that says "you have not filled out: blablabla" or sometimes, it goes through then goes back to the current page highlighting the ones that are required.

Easiest one/way?
Was This Post Helpful? 0
  • +
  • -

#4 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5239
  • View blog
  • Posts: 14,033
  • Joined: 18-April 07

Re: Form validation and submission?

Posted 01 July 2010 - 01:55 PM

This is done either using javascript which can perform some validation client side (if they have it enabled) or you do it again through the server-side code. But the only way to force them to fill in the field is through validation... javascript or server-side. Again, which is why it is generally done through a script like PHP. The best forms do both. Javascript to check for required fields and server-side to again check all fields in case the user doesn't have javascript enabled.

:)
Was This Post Helpful? 1
  • +
  • -

#5 openoutcome   User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 51
  • Joined: 06-November 09

Re: Form validation and submission?

Posted 01 July 2010 - 02:02 PM

Thanks, guess there's no way around it. Time to learn some quick PHP. Lol.

Thanks for all your help! :bigsmile:
Was This Post Helpful? 0
  • +
  • -

#6 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4208
  • View blog
  • Posts: 13,283
  • Joined: 08-June 10

Re: Form validation and submission?

Posted 01 July 2010 - 02:05 PM

for this, a simple mail code (cf. PHP manual) may suffice. if you want to write more complex mails, consider using a mail library (e.g. SwiftMailer).
Was This Post Helpful? 1
  • +
  • -

#7 openoutcome   User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 51
  • Joined: 06-November 09

Re: Form validation and submission?

Posted 01 July 2010 - 02:32 PM

Thanks Dormilich,

I also found this which may be helpful to me, (and anyone else who runs into this trouble)
http://www.freeconta.../email_form.php

Seems pretty straightforward, I'll be making my own for the next few hours XD
Was This Post Helpful? 0
  • +
  • -

#8 singularity   User is offline

  • D.I.C Head
  • member icon

Reputation: 17
  • View blog
  • Posts: 184
  • Joined: 17-October 08

Re: Form validation and submission?

Posted 02 July 2010 - 10:19 AM

View Postopenoutcome, on 01 July 2010 - 08:32 PM, said:

Thanks Dormilich,

I also found this which may be helpful to me, (and anyone else who runs into this trouble)
http://www.freeconta.../email_form.php

Seems pretty straightforward, I'll be making my own for the next few hours XD


Well Also don't forget the following link for php topics:

http://www.dreaminco...-php-tutorials/
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1