Would like to Create a Web Form

Live forum: http://forum.freeipodguide.com/viewtopic.php?t=73922

doylnea

19-02-2008 20:49:27

I'd like to add a webform to my blog. I have one installed, but it's hosted off-site, and is somewhat limiting. It looks like this

http/" alt=""/img110.imageshack.us/img="110/5223/78778359to4.png[" alt=""/img5ea8f3fa27]

Could someone point me to a place where I can learn how to make one that would email the content generated?

Thanks

hehehhehe

19-02-2008 21:08:01

If you google "php email form" you'll see a bunch of scripts you can use, and they'll give you both the html and php.

This one should work but hopefully you can make it less ugly
http//www.ibdhost.com/contact/[]http//www.ibdhost.com/contact/

This one looks clean but it says you need to leave any references to the website (like next to the submit button)
http//formtoemail.com/[]http//formtoemail.com/

doylnea

19-02-2008 21:11:09

Thanks - I'm not looking for an email submit form, but one where someone can type in something, and then that result is emailed to me? Does that make sense?

TFOAF

19-02-2008 21:18:30

What do you mean if someone can type in something and then the result is emailed?

If I think I know what it is, I can probably easily code it for ya.

ajasax

19-02-2008 21:35:37

What you're probably looking for is a PHP script that uses the mail() function to automatically e-mail you the form data when a user submits it. It's pretty easy to do if you know PHP. TFOAF can probably help you out ;)

bruman

19-02-2008 21:36:08

http//formtoemail.com/ is great, I have used it before.

doylnea

19-02-2008 21:57:40

Thanks for all the help. TFOAF, I want something that emulates the look of the image I posted, where someone can type something in the form/box, and whatever is typed is emailed to a specified emailed address.

TFOAF

19-02-2008 22:22:53

Alright. If you have AIM, AIM me. If not, we'll do it via here or PM or whatever. I've coded these things before. So basically you just want a box, and whatever's in the box gets emailed to a default email address? If I have time tomorrow after class I will see what I can do. But I should go to sleep now, I got class at 8.

hehehhehe

20-02-2008 07:13:35

[quotedf73fb4a3b="doylnea"]Thanks - I'm not looking for an email submit form, but one where someone can type in something, and then that result is emailed to me? Does that make sense?[/quotedf73fb4a3b]
That's exactly what the scripts like formtoemail do. They take the info in the form and email it to you at a specific address. You can strip out any field you don't need, and just have exactly what you posted in the image.

There are many scripts for this already on the net so I wouldn't waste time recoding it, not that it's very hard. I have some too that I could give you but in the end it'd be the same as those on the net pretty much.

EDIT Here's one that will output a customized script for you based on exactly what you want. I'd used it years before but had to google for it since it's lost somewhere in my bookmarks.
http//www.tele-pro.co.uk/scripts/contact_form/[]http//www.tele-pro.co.uk/scripts/contact_form/

TFOAF

20-02-2008 07:44:59

@hehehhehe, I can code it much easier and probably faster. P It's basic PHP.

hehehhehe

20-02-2008 08:01:38

[quote5634fd00dc="TFOAF"]@hehehhehe, I can code it much easier and probably faster. P It's basic PHP.[/quote5634fd00dc]
There's no coding required if you use a pre-existing script so how would you do it easier and faster?

hehehhehe

20-02-2008 08:21:28

Took a few minutes to modify generated script

HTML-
[quote24a3e1f367]<form method="POST" action="contact.php">
<p>message<br>
<textarea name="message" cols="50"></textarea>
<p><input type="submit" name="submit" value="Submit">
</form>[/quote24a3e1f367]


PHP-
[quote24a3e1f367]//<?php
// get posted data into local variables
$EmailFrom = "comments@fipg.net";
$EmailTo = "doylnea@fipg.net";
$Subject = "comments from form";
$message = Trim(stripslashes($_POST['message']));

// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}

// prepare email body text
$Body = "";
$Body .= "message ";
$Body .= $message;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From <$EmailFrom>");

// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
//?>[/quote24a3e1f367]

In the php script, remove the // from the first and last lines before using and save it as contact.php. You can get rid of the validation lines, or else setup an ok.htm file to show when it works and error.htm file to show when the script has a problem. Also change the $EmailTo and $EmailFrom to whatever you like.

bballp6699

20-02-2008 08:41:33

But but, TFOAFs wants to do it!!!!

Hehehehehes should work for what your looking for from the sounds of it.

doylnea

20-02-2008 08:54:41

lol, <3's all around. thanks guys.

TFOAF

20-02-2008 10:37:35

[quotea16db33e27="hehehhehe"][quotea16db33e27="TFOAF"]@hehehhehe, I can code it much easier and probably faster. P It's basic PHP.[/quotea16db33e27]
There's no coding required if you use a pre-existing script so how would you do it easier and faster?[/quotea16db33e27]
lolz. the script you used is more complicated.

CollidgeGraduit

20-02-2008 11:06:58

[quote5489709926="TFOAF"][quote5489709926="hehehhehe"][quote5489709926="TFOAF"]@hehehhehe, I can code it much easier and probably faster. P It's basic PHP.[/quote5489709926]
There's no coding required if you use a pre-existing script so how would you do it easier and faster?[/quote5489709926]
lolz. the script you used is more complicated.[/quote5489709926]

So? No point in recoding something that someone else has already done.

TFOAF

20-02-2008 11:18:23

But it's something basic that a lot of people don't need pre-made scripts for. I'm just saying...lol. There's nothing wrong with it though.

hehehhehe

20-02-2008 11:42:06

[quote93d9fba0b8="TFOAF"]But it's something basic that a lot of people don't need pre-made scripts for. I'm just saying...lol. There's nothing wrong with it though.[/quote93d9fba0b8]
Actually, the script I posted is as basic as it gets. We could even just cut out that validation part so all it does is take the text, formats it a little and then emails it. Doesn't get much easier than that.

You're spending more time making these posts compared to the time it took for me to paste that code lol.

dmorris68

20-02-2008 13:43:35

TFOAF, a "basic" PHP script is exactly the reason we have so many PHP mail() based e-mail exploits. You have to code in protection from things like header injections, otherwise you open up your PHP form to a spambot that will use it to generate tons of spam, probably DOS'ing your host in the process.

I havent' examined them, but I'm sure most of the pre-written scripts account for this, so doylnea would be wise to use something that is already tested and proven over the "fewest lines of code" approach.

http//www.securephpwiki.com/index.php/Email_Injection