HTML form

Hi Folks,

I want to create a simple HTML / CSS website where people can fill in soccer game scores. Here is an example of the code I want to use;

<form method="post" action="mailto:myemailadres@domain.com">
 <em>Question 1:</em> <input type="text" size="20" maxlength="40" name="Question 1"><br>
 <input type="submit" value="Send">
 </form>

Open in new window


The send button opens up the e-mail client on the computer. Is there a way to create a send button that sends the form immediately?

Is this the best way to create a form using just HTML? Are there other ways to create a form with a simple script, like with JAVA Script or something?
LVL 7
SvenIAAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
It is actually not a very good way of sending email besides the fact your email will just end up getting spammed.

You will want to do this with a server side language such as php or asp.  Or you can use an api for something like mandrill  https://mandrillapp.com/docs/integrations.html with different types of integrations.  If you can use something other than javascript, that would be best, but the js being the only choice will work.
0
SvenIAAuthor Commented:
And what if people have to logon to the website first, before being able to send the form.... Is it save from spamming?
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
If you are going to do that, just use a link with your email.

If you have people logging in, that means you have some type of server side code like php or asp.  Use that to send your mail.  The form should post to a processing page and the processing page will send out the mail and redirect to a thank you page.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

rbudjCommented:
Forms are two parts:
1. Create the form
2. Process the form

If your server supports PHP, here is a simple mail script that will get you started.

<!doctype html>
<head>
<title></title>
</head>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$q1 = $_POST['q1'];
$q2 = $_POST['q2'];

                        $recipient = "myEmailAddress@domain.com";
			$subject = "Contact Form - My Form";
			
			$msg = "Question 1: $q1\n\n";
			$msg .= "Question 2: $q2\n\n";

			mail("$recipient", "$subject", "$msg", "From:contact@domain.com");
			//echo mysql_error();
			$reply = "Thank you $name for contacting. Your message has been sent!";
            }

?>

<body>
<form action="" method="post">
Question1 <input type="text" name="q1"><br>
Question2 <input type="text" name="q2"><br>
<input type="submit" name="submit" value="Submit">

</body>
</html>

Open in new window


If you do not use a server to process your form, your website will rely on the visitors local mail client to send the mail. The problem is that many people use web mail such as gmail and yahoo; they will not be able to process your form properly.
0
SvenIAAuthor Commented:
Thanks rbudj

What does the 'submit' button do in your script? What if I do have a mailserver, where can I specify it in the script?
0
rbudjCommented:
When the submit button is pressed. the page "refreshes" itself. It takes the form values and places them into variables using the php script. Those values are then sent using the mail() function.
0
SvenIAAuthor Commented:
Thanks. I used a Wordpress plugin to create forms. I bought Visual Form Builder PRO.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.