Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I start to learn HTMl my self. Made a contact form and copied code block as:
<form id="ContactForm" action="">
<div>
<div class="wrapper">
<input type="text" class="input" >Your Name:<br>
</div>
<div class="wrapper">
<input type="text" class="input" >Your E-mail:<br>
</div>
<div class="wrapper">
<textarea name="textarea" cols="1" rows="1"></textarea>Your Message:<br>
</div>
Send
Clear
</div>
</form
The page show ok on browser, but the user cant send the form to my mail. I know may mail suppose be in somewhere on code,
What's missing?
Thanks
Haim Rodrik
The simplest way of sending an email from your form is to use the mailto: action:
<form id="ContactForm" action="mailto:your#email.com">
When the form is submitted (when the user clicks the Send button) the default email client would be invoked with your email address and the form fields pre filled in the email. The user can edit the email and send it of.
However, this is not a reliable solution and probably not what you are looking for. In order to send emails "in the background" you will have to add some server side code to do handle your requests, for example PHP. If you have a working PHP server installed you can read the examples on how to send email in this thread for example: How to send an email using PHP?
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I just want to log submissions to like a txt that I can look at in github, I want a submission form like: Password & email, then when you click okay, it logs it into like a txt file in github, with "email:password" format.. Anyone know how to do this? I would really appreciate it!
Here is my code so far:
<div class="shopping-input input-text">
<input type="text" placeholder="Enter your Minecraft username." name="username" maxlength="16">
</div>
<div class="shopping-continue element_button">
<div class="l"></div>
<div class="r"></div>
<div class="button_block">
<a>Continue</a>
</div>
</div>
From your comments, it seems as though you don't have much experience with forms or web development in general.
You say you want to "log" it to a text file. This is generally not the best idea, because text files are usually easily accessible and readable to the public. It's best to use a database instead.
However, to either use a text file or a database, you're going to need a server-side language that can interact with the server (such as files). The tagged languages "HTML" and "CSS" will not help you out with the form submission — they are client-side languages that help with the formatting of the page and only interact with the user to the browser, and cannot edit files.
PHP is an example of a server-side language. You should read up about it and file IO.
Assuming you do know how to use PHP, this would be a very simple example:
HTML FILE: index.html
<form action="action.php" method="post">
Enter your name here: <input name="name" type="text" />
<input type="submit" value="Submit" />
</form>
PHP FILE: action.php
<?php
$name = $_POST["name"];
$file_to_write = fopen("name_file.txt","w+");
fwrite($file_to_write, $name);
fclose($file_to_write);
?>
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have an HTML form; can I send an email with the contents of the form when the user clicks the submit button, using only HTML?
How do I have the email sent with a certain subject?
HTML is run on the client side. You need a server if you want to send an email. Something like node or php. Once you have a server running and hosting your html, you can lookup the documentation to send an email.
Here's an example of a php server sending an email: How to send an email using PHP?
you need php or server side language to make this work.......e.g.
HTML FILE:
<form action="answer.php" method="POST">
email address: <input type="text" "name="email"/>
Name: <input type="text" name="name"/>
<input type="submit"/>
</form>
Php file answer.php
<?php
//form validation
if( $_POST ) {
$name=$_POST['name'];
$email=$_POST['email'];
$subj= "my subject or do a form field!";
$content = "content from a form field etc!";
$to= "myemail#email.com";
$from = "from: $email";
}
if ( $email ) {
mail($to, $subj, $content, $from);
}
?>
To be honest you are opening up a whole new chapter on your skills. the above code will be much abused by spammers, etc. You might be better to look at wordpress which you can use to provide a lot of the php code you need through plugins etc. You can use a outlook open but again this opens your email to spammers, etc.
if you are using php you can use phpmailer phpmailer
Very easy to use and it has great documentation
You can also use "MAILTO:someone#example.com" as your form action.
<form action="MAILTO:someone#example.com" method="post" enctype="text/plain">
Name:<br>
<input type="text" name="name" value="your name"><br>
E-mail:<br>
<input type="text" name="mail" value="your email"><br>
Comment:<br>
<input type="text" name="comment" value="your comment" size="50"><br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
Without using PHP, your only option is to set up your fields and let the user complete the email from their Email client (ie. Outlook). See this link for the code: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_mail.
When I insert my into my website and I submit the form Windows 8 pops up a little menu and asks how I want to open this (mailto)
This is my code for the form
<FORM METHOD="POST" ACTION="mailto:myemail">
<div id="subscribe">
<input type="text" placeholder="Enter your email address...">
<input type="submit" value="Submit">
<div class="clear"></div>
</div>
The mailto is the part i'm having problems with. Any help would be great.
You have to specify a default program for your operating system to email from - this is not something that you can fix through HTML. Whoever is going to your webpage will see a different dialog box if they haven't already configured their default mailto options.
You will not be able to make it automatically send an email through HTML alone- you will have to use a server-side language such as PHP if this is what you intend to do.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have magento commerce, and I am creating in html an automatic e-mail that is going to be sent when someone signs up (in Dreamweaver).
In the HTML code I have a button that is about subscribing in our newsletter. What is the code that I have to link to this image, so if someone clicks on it he will subscribe to the newsletter.
Thanks in advance,
Frank
The call goes to:
http://yourdomain.de/index.php/newsletter/subscriber/new/
But form data is sent via post as you can see in the Mage_Newsletter_SubscriberController newAction, where you find the following line of code.
$this->getRequest()->isPost() && $this->getRequest()->getPost('email')
So you need to name your form field 'email'
Good luck!
Edit:
Just use something like this:
<form action="http://yourdomain.com/index.php/newsletter/subscriber/new/" method="POST" id="newsletter-validate-detail">
<input type="text" class="input-text required-entry validate-email" name="email" id="newsletter">
<input type="image" src="path to image" name="submit" />
</form>
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am new to php. I have created a form but I am unable to understand where would this form be stored when the user presses submit. Can anyone please help me out? Thanks
<h1><a>Contact Us</a></h1>
<form id="form_317009" class="appnitro" method="post" action="">
<div class="form_description">
<h2>Contact Us</h2>
<p>Please enter the details here to get a quote.</p>
</div>
<ul >
<li id="li_1" >
<label class="description" for="element_1">Name </label>
<div>
<input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" value=""/>
</div><p class="guidelines" id="guide_1"><small>Please enter your name in it.</small></p>
</li> <li id="li_3" >
<label class="description" for="element_3">Email </label>
<div>
<input id="element_3" name="element_3" class="element text medium" type="text" maxlength="255" value=""/>
</div><p class="guidelines" id="guide_3"><small>Please Enter a valid email so we can contact back.</small></p>
</li> <li id="li_2" >
<label class="description" for="element_2">Subject </label>
<div>
<textarea id="element_2" name="element_2" class="element textarea medium"></textarea>
</div><p class="guidelines" id="guide_2"><small>Please describe the package in which you are interested so we can reach you out and give you a quote.</small></p>
</li>
<li class="buttons">
<input type="hidden" name="form_id" value="317009" />
<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
</li>
</ul>
</form>
It gets stored wherever you like.
You'll need to write a php app to handle the POST HTTP request from the form, which can do something to the data: put it in a database, display it back to the user, email it, throw it away, etc.
Submitting the form sends an HTTP POST request to the URL in the action attribute.
You need to write server-side code to handle that POST; otherwise, nothing will happen.
Each form in HTML has an action attribute. Imagine the below form:
index.php
<form name="myForm" method="post" action="check.php">
<input type="text" name="username" />
<input type="submit" value="send" />
</form>
When user press submit button, your form will send to your defined address as your form action. Here, you will send your form data to check.php file.
Then depend on what was your form sending data method , you can use $_GET or $_POST in PHP to achieve the input sent data. This is an example:
check.php
<?php
$username = $_POST['username'];
echo('Welcome dear '.$username);
?>
Attention: No security issue applied in the code above and they are just a simple code to introduce you to what you need depend on your question.
The form is submitted when the button is clicked, the location it's submitted is decided by you the developer. It can go to a database, send an email, write a file, etc. you define this in the action attribute of the form tag.
Check out this reference for more information and how to get started: http://www.tizag.com/phpT/forms.php
This form would be submitted to the same page that is currently loaded (action="") and it will be stored in the $_POST array. If you want to work with this data - or store it for the future - you'll need to write code to handle the $_POST array:
<?php
if (isset($_POST)){
//do something here with the data.
}
?>
However, as soon as the page is finished loading, the $_POST array will be discarded, so if you want to do anything long-term with the data, you'll need to store it (you can do this using sessions, cookies, write the data to files, etc).
You'll want to read a lot more about this before you start working, though.
The action attribute of the form element determines what URL the data will be sent to.
In this case, as it is empty, the page will post to itself.
You need to have server side code to capture and store this data, otherwise it will be lost.
As for where it will be stored - that is up to you. You can save to a file, a database, send it by email or sms or even just ignore it.
Its better to think off the data less stored more posted and can be retrieved with
$_POST['guide_1'];
To store the data you would have to retrive the post and then store it some where your self
Also a good link to get and post in php is http://www.tizag.com/phpT/postget.php