LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 06-30-2005, 01:33 PM   #1
J_K9
Member
 
Registered: Nov 2004
Distribution: Slackware 11, Ubuntu 6.06 LTS
Posts: 700

Rep: Reputation: 30
Forms in HTML


Hi,

I have tried to make a comment box and form on my website, with a "Submit" button and a "Reset" button. What I would like to know though is how to make the form work so that the data is stored somewhere or forwarded to an email address. I would also like the user to be redirected to another page once they have clicked on the Submit button. Here is my code:
Code:
 <form name="form1" method="post" action=""> 
        <textarea name="Comment_field" cols="50" rows="10" id="Comment_field">Type in your comments here!</textarea>
        <br>
        <br>
        <input name="Submit" type="submit" value="Submit Comment">
        <input type="reset" name="reset" value="Reset">
        <br>
      </form>
Any help would be appreciated. TIA,

J_K9
 
Old 06-30-2005, 01:49 PM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Where you have action="" in your form tag, if you want the form to be mailed, you need to have action="mailto:<email address>", but without the angle brackets. For redirection, I don't think it's possible with just HTML. You might need to use something like PHP or ASP.
 
Old 06-30-2005, 01:54 PM   #3
titanium_geek
Senior Member
 
Registered: May 2002
Location: Melbourne Australia
Distribution: it died/ macosx
Posts: 2,478

Rep: Reputation: 50
you need a form handling script- the location of which (on your server) is called with action. languages include perl, php, (javascript?)

you could learn enough of these languages to write your own, or you could get forum handling scripts online- these links might help you.
http://www.google.com/search?hl=en&q...=Google+Search
http://freshmeat.net/search/?q=form+...&Go.x=0&Go.y=0

hope this helps...

titanium_geek

EDIT: the simplest way to do this would to have the mailto option, and then to redirect, to have a javascript (security guys can hush!) function that would run as the submit button was clicked.
seriously though, many people disable javascript to avoid unfun stuff like popups..

Last edited by titanium_geek; 06-30-2005 at 02:12 PM.
 
Old 06-30-2005, 02:23 PM   #4
J_K9
Member
 
Registered: Nov 2004
Distribution: Slackware 11, Ubuntu 6.06 LTS
Posts: 700

Original Poster
Rep: Reputation: 30
Thanks to both of you! I'm looking to host this on an internet web hosting site (yahoo), but tried it by previewing the page (with the mailto value in "Action"), but it just came up with my standard email program with the subject "Form Post From Mozilla" and the text
Quote:
Comment_field=Hi%2C%0D%0A%0D%0AI+love+your+site%2C+thank+you%21&Submit=Submit+Comment
I had a feeling it wouldn't send the email automatically (because there are no SMTP details configured), so how would I store it into a database? I had a look at your links titanium_geek, but how would I use (for example, a PHP script) on the web hosting company's server? I'm sorry, I don't really understand much about PHP or other scripting languages yet!

What would be the simplest way for me to save the comments in the form straight to a database which would be within the web folder, but only I would be able to (i.e possibly password protected)? Thanks, and I'm sorry I don't really understand the scripting languages!

J_K9
 
Old 06-30-2005, 02:40 PM   #5
titanium_geek
Senior Member
 
Registered: May 2002
Location: Melbourne Australia
Distribution: it died/ macosx
Posts: 2,478

Rep: Reputation: 50
if you are using yahoo's free hosting, then get the form (perhaps called the guestbook) stuff from them. hosting like them is picky about other scripts on thier servers...

titanium_geek
 
Old 06-30-2005, 03:21 PM   #6
J_K9
Member
 
Registered: Nov 2004
Distribution: Slackware 11, Ubuntu 6.06 LTS
Posts: 700

Original Poster
Rep: Reputation: 30
Hmmmm...this is more complicated than I thought it would be. I tried Yahoo's form->email script but I'm not very sure about it. I understand how complicated it must be to make a database and then make the form write to that database, but I'm willing to learn. I have found this tut which involves Perl and stuff but I'd much rather a database which the forms store data to....am I trying to run before I can walk?

J_K9
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL results to html forms using PHP xemous Programming 3 08-15-2005 04:27 PM
passing an array from html-forms to php prabhatsoni Linux - Software 2 06-04-2005 01:11 AM
HTML Forms belorion Programming 1 02-02-2005 12:41 AM
HTML, PHP, forms, submitting data Problem Silent1 Programming 3 08-31-2004 04:03 PM
Breaking up html forms logicdisaster Programming 4 06-18-2004 01:50 PM


All times are GMT -5. The time now is 03:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration