Sending information from a FORM
I'm trying to write 'Send Comment' section to one of my pages. I can get a pop up window with a form in, and I know you can send the data by saying 'form action="MAILTO:email@example.com" '.
That's very clumsy, since it opens up the email client.
I am aware of the GET and POST methods, but am a little baffled as to how to use them and how to process the information. I am quite happy to enter the comments onto the webpage manually when I get them.
I would be very grateful for any assistance.
That's correct. The mailto attribute does not send anything on its own. You can not submit the form with HTML alone. You are going to need to use a server side scripting language like PHP, .NET, Coldfusion, Ruby, etc. to actually send the information in the form.
Originally Posted by cnh
The exact syntax will vary depending on your language of choice, but it will involve extracting the information via the name attribute of the form elements (other ways exist as well), and processing them some way. If you're going to use a database, be sure to protect your site from SQL injection when doing this.
If you choose to use PHP, here is some code to get you started: http://www.w3schools.com/php/php_forms.asp
(PS sarksap overflows its divs in Firefox with my current settings)
PS - Thanks for the tip about Sarksap. I've been working on a full HTML5 redesign of the site in the past weeks. It will be released in the next few days.
Thanks. I read thru the PHP methods, and although I got the general idea, I think implementing it might be another matter!"
Look into NateMail I use it to handle all my form handling and its free. Its written in PHP and will be sent to your email directly. It also protects against spam among other things. I can send you the code if you need it as I think he stopped working on it but I still have the files on my server processing my forms and my clients forms.
Thank you for the link to NateMail - it looks to be exactly what I want.
I downloaded the HTML version and I'll try playing around with it.
Works a treat.
If I put a 'Make a comment' link at the end of each blog entry, how would I know which entry the reply comes from? I can imagine the blog page passing on a reference to the page with the form on, and that page passing on the reference to the email form, but working out how to do it is another matter.
Honestly I couldnt tell ya. I just use it to process simple forms. I dont try and modify anything or use it for blogs or anything like that. Yo can try asking in the PHP section or mailing thre creator directly about the question you have.
Okay. Many thanks, anyway.
I think ASP could be very useful in order to manage forms in elegant ways. You have to link the form to an ASP page, which will send you all the information you need (sender name, messages and anything requested in the html form), and then redirects to the site.
You'll find useful informations here:
And if you want, take also a look at my works...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)