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.
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.
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.
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 : email@example.com
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
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!
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.
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.
riv_, you're welcome! It's always a pleasure
|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
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
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!
|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"
Sometimes, I think to myself (I learned this expression from Louis Amstrong ) 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!
Thanks guys.. you have no idea how much I needed to hear that just now!
(So the script works... putting it together and making it look pretty... there's a challenge!)