php mail form
#1
Posted 10 May 2006 - 04:23 AM
#2
Posted 10 May 2006 - 07:08 AM
There are many Email PHP scripts out there, but beware that many are not as secure as some. Got to go to VA, but will try to track down one or two scripts for you if you do not have free hosting and a CPanel Form Utility.
Maybe someone else will come up with the info you need while I'm gone.
Ron
#3
Posted 10 May 2006 - 11:46 AM
p.s. also i'm gonna need some radio buttons in it, and in the email it sends me it should tell me something that i determine it to say when a certain radio button is checked. reason for all this pickiness is because i'll start a web design company with a few guys, and wouldn't want to get AS MUCH spam as i would if i didn't go through all these measures. also, the radio buttons would be like: web design, logo design, banner design etc
Edited by TaNkZ101, 10 May 2006 - 11:51 AM.
#4
Posted 13 May 2006 - 05:12 AM
I seteled for a very simple form you can see it in action on my e-mail page http://site.frih.net/email.php it is easy to add more things to it, and I will help you with that if you want. The form, error page, sucess page, and script is all in the same file 3KB file.
Edited by Michael, 13 May 2006 - 05:13 AM.
#5
Posted 13 May 2006 - 05:53 AM
Conclusion: Now that I know what I want, I need a php mail form (script) that will allow people to send me an email with php and has radio/check buttons (at least one must be checked/selected!), and also has an anti-robot-spam system like described above. I'm constantly searching for a script like this, but help is welcome!!!
#6
Posted 13 May 2006 - 06:05 AM
into the form I use? I going to do it since it looks like a good idea.
Edited by Michael, 13 May 2006 - 06:06 AM.
#7
Posted 14 May 2006 - 05:46 PM
It seams that doing anything in the way of stoping bots, ends up blocking some users out. And why is anyone going to target you anyway? Do you have something they (the spamers) want?
Edited by Michael, 14 May 2006 - 05:47 PM.
#8
Posted 15 May 2006 - 09:47 AM
#9
Posted 15 May 2006 - 05:47 PM
Name: Your Name
Radio button selected: radio three
Comments: Enter Comments Here
There is a copy of the script http://site.frih.net/email.txt
Make sure you rename it to email.php other wise it will not work.
Edited by Michael, 15 May 2006 - 05:47 PM.
#10
Posted 17 May 2006 - 05:24 PM
As for including radio buttons and such, it's easy enough to email the contents of the form to yourself in an intelligibale email. All you have to do is give each field a sensible name/value pair, then, when processing the form, build a custom email body using the form names as PHP variables.
But I think it would make more sense with an example.
Here's a form with radio buttons, text fields, and check boxes, just to cover all bases:
<form name="myform" action="sendform.php" method="post"> <input type="hidden" name="submitted" value="true"> <table> <tr> <td><input type="radio" name="vehicle" value="car">Car <td><input type="radio" name="vehicle" value="truck">Truck <td><input type="radio" name="vehicle" value="van">Van <tr> <td colspan=3>Email:<input type="text" name="email"> <tr> <td><input type="checkbox" name="drive">Drive <td><input type="checkbox" name="ride">Ride <td> </table> </form>
This form would look horrible in a page. But, hey, that's on-the-fly examples for ya.
Then, your processing script would go something like:
<?PHP if ($_POST["submitted"]) { // build body of email as $body using $_POST variables. $body = ...; mail("[email protected]", "Form Submitted", "$body", "$_POST[email]"); } ?>
To check to make sure all forms have been filled in, I would suggest using javascript, but if you insist that it be solely PHP, you can just check to make sure each individual variable associated with each field is available.
You could also use regular expressions to make sure the email given is valid.
#11
Posted 20 May 2006 - 06:37 AM
maybe something like
if check1 or check2 or che3 are not checked, (code to execute).
i'm asking for as much help as possible, im as new to php as one can be!
#12
Posted 21 May 2006 - 07:39 AM
<?php if (!($check1) && !($check2) && !($check3)) { echo "You haven't checked any checkbox. Please check it"; } ?>
A small explanation (just in case):
"!" means not
"&&" means and
Hope it makes sense.
#13
Posted 21 May 2006 - 08:07 AM
can anyone tell me exactly in which format to put things after $body? do i have to use echo? give me an example please! and how would i make it say (if check1 is checked, echo "customer selected search engine optimization")? are u guys sure i don't have to use request anywhere?
Edited by TaNkZ101, 21 May 2006 - 09:40 AM.
#14
Posted 21 May 2006 - 10:48 AM
$body = "$check1 was checked\n(radio buttons' name): $radio\nComments: $comments";
PHP will automatically expand the $-variables to their respective values inside the quotes.
and how would i make it say (if check1 is checked, echo "customer selected search engine optimization")?
if ($check1) { echo "Customer selected search engine optimization.\n"; }
An alternative to Hai Mac's multiple-checkbox-check is:
if ($check1 || $check2 || $check3 || .....) { // process checked items } else { echo "error message"; }
Edited by knexor2, 21 May 2006 - 10:49 AM.
#15
Posted 21 May 2006 - 12:17 PM
how do i make a submit button (that will work with the form above, i.e. send it)?
can u explainthe first code u posted in ur last replay knexor please? like what are the "/n"s for etc.
Similar Topics
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users