FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


How to email data...





riv_
I'm having (yet another) total brain fart. I've got a simple html form. I want to do some stuff with the data and have it emailed. How do I do that?
I'm confused because I need the form action to be PHP_self and mailto at the same time.
Not exactly rocket science, but I'm stuck just the same.
thnn
You will need to set the form action to either another page or the same page and have the page detect if the form has being submitted using an if statement.

You will then need to use the PHP mail function to email the data to you,
info on this can be found at www.php.net/mail

Hope this helps.
riv_
Thanks.
For some reason I was all jumbled about how to get the information INTO the email once I'd processed it.
Turns out, it was all fine. But the email was getting derailed before it made it to my inbox (through no fault of my own for a change) so I had assumed I did it all wrong.
Works fine now.
Thanks, though.
cafefort
Well, nice to see that you get it.
I have had a hacker on a web app i made, and I
lately discovered the hole. It's a form and mailing thing too.

Hope my exeperience will help you prevent the problems I got.

1) Use $_POST variables instead of global ones, in order to prevent
your form to be accessed and used through GET urls

imagine your script is mailer.php and the variables are $name ant $email
well, without the use of $_POST the script may be executed by only displaying this page : mailer.php?$name=badguy&email=hack@hckland.tld
This page may be displayed throgh a loop in another website hence a possiblity for spam.

2) Now, Imagine another problem, the one I got actually,
the man submitted a list of mails seperated with commas, and since the script was an autoresponder, the message was sent to the whole list!
So IMHO, a verification of the inputed email is really useful.

Hope this helped somehow and sorry for my poor english,
it's just my 4th language Smile
riv_
@cafefort;
Thanks for the advice. Sometimes it's a little scary, all the possibilities. I'm such a n00b with all this stuff - just to get a basic script working is sometimes a challenge. I really appreciate input from people with some more experience!
And I guess it's a good sign, that I'm actually able to cope with it now, and do something with it. Until recently, it was just too much information!
I knew about the $_POST, and had used stripslashes and everything... but it hadn't occured to me to add extra measures and verify the address too! Thanks again!
DoctorBeaver
I've got a form design program that really simplifies everything. It's WYSIWYG with lots of great features. You can use your own form handler or have the homesite of the program writer send an email to the address you specify.

It creates the form in Javascript so $_POST or $_GET variables are there for you. I've used it a lot & I think it's the best form program around.

You can download it FREE from http://webformdesigner.com

It is so easy to use, you can have a really complex form up & running in a few minutes. It has every kind of input you could want, including text areas, drop-down lists, radio/check boxes, option lists... you name it, it's there. Check it out. You'll wonder how you ever did without it!

The reason I've suggested this program here is that it does input validation for you. Your email address problem would be handled.
cafefort
riv_, you're welcome! Smile It's always a pleasure

Quote:
Sometimes it's a little scary, all the possibilities. I'm such a n00b with all this stuff - just to get a basic script working is sometimes a challenge. I really appreciate input from people with some more experience!


Don't be affraid, believe me: experience is a matter of time and good will
or so I humbly think Smile

The web application, I've been talking about was made that's 4 years now,
The hacker attaqued in febreray 2006. And I didn't noticed what was the real
problem. I never thought I can make some "stupid" errors, I just forgotten
how n00b I was 4 years ago Wink

But I keep a large smile and believe that great things are still waiting
me to learn.

Keep the faith bro and gimme a big smile! Smile
DoctorBeaver
Quote:
But I keep a large smile and believe that great things are still waiting me to learn.


Cafefort - that's a good philosophy. We never stop learning, and the prospect of what's around the corner, what we may learn tomorrow, has driven mankind forward since the beginning of time.

"A fool thinks he know's it all. A wise man knows that he knows very little"
cafefort
Thanks Doc,

You're right!

Sometimes, I think to myself (I learned this expression from Louis Amstrong Smile ) what would be mankind if prmitive men, those who were living in
caves were to lazy to invent things like hammers, axes and such...

Really, I humbly think when procrastination and lazyness comes our way,
we should simply say: "Ok, man... let's do it for human kind!"
With this kind of humour, the thing will be kinda game and we'll be pleased
to do it.

Thanks again and have a terrefic nice day! Smile
riv_
Thanks guys.. you have no idea how much I needed to hear that just now!Very Happy
(So the script works... putting it together and making it look pretty... there's a challenge!)
Related topics
[php scripts ] phpweather&email
New Data confirms a big earthquake in Central US
Submission Forms
The best mobile Phone
form to email service: 20 FRIH$
Adding field to message data
email form handling on a windows 2000 server help.
problem in saving and retrieving data in longtext format
[solved] html multiply list doesnt give all values
Slashes =(
Need help fixing my php file
Email in saying do not delete?
Strange email received from mailer-daemon
The best free email client
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.