PDA

View Full Version : form help



marcuscable
March 7th, 2003, 13:56
in html, how do I make a form that people can fill out and press submit to send it to my email?
someone had given me one before, but it was too small and it didn't look very good...is there any others?

NONO
March 7th, 2003, 16:33
let me see... 2 parts of your question:
1. do you how to make a form in html?
2. do you want to use html only, or use cgi, php... ?

marcuscable
March 7th, 2003, 19:52
Whatever is easy and professional looking:)

Thanks!:D

Kaliber
March 7th, 2003, 20:19
This is a script I made: http://www.mutate.us/kamail

marcuscable
March 7th, 2003, 20:20
howinstall?:)

NONO
March 8th, 2003, 21:11
1. the easiest way is HTML only, not not professional looking:

<form action="YOUR E-MAIL ADDRESS " method=post> (your form content) </form>
sender send e-mail via his email software.
i.e. YOUR E-MAIL ADDRESS = 123@456.com


2. not too easy (also not too hard), looking more professional:

(1) use CGI (cgi, pl, php, asp ... ), If you don't understand any cgi, it would be harder for you.

(2) confirm the server mail( ) function is enable.

(3) you just make a beautiful form, and set action as:
<form action="YOUR CGI NAME " method=post> (your form content) </form>
i.e. YOUR CGI NAME = yourcgi.php
OR yourcgi.cgi
OR yourcgi.pl
OR yourcgi.asp

I'm not sure it's clear for your or not. :)

by using PHP - You may go this page for more reference & teaching:
(The author's teaching is easy & clear, you know it then you can modify it)
Sending Form Data in E-Mail
http://www.thickbook.com/extra/php_email.phtml
more, In Form-Related...
http://www.thickbook.com/extra/index.html?t=fm

marcuscable
March 12th, 2003, 09:13
Originally posted by NONO
1. the easiest way is HTML only, not not professional looking:

<form action="YOUR E-MAIL ADDRESS " method=post> (your form content) </form>
sender send e-mail via his email software.
i.e. YOUR E-MAIL ADDRESS = 123@456.com


2. not too easy (also not too hard), looking more professional:

(1) use CGI (cgi, pl, php, asp ... ), If you don't understand any cgi, it would be harder for you.

(2) confirm the server mail( ) function is enable.

(3) you just make a beautiful form, and set action as:
<form action="YOUR CGI NAME " method=post> (your form content) </form>
i.e. YOUR CGI NAME = yourcgi.php
OR yourcgi.cgi
OR yourcgi.pl
OR yourcgi.asp

I'm not sure it's clear for your or not. :)

by using PHP - You may go this page for more reference & teaching:
(The author's teaching is easy & clear, you know it then you can modify it)
Sending Form Data in E-Mail
http://www.thickbook.com/extra/php_email.phtml
more, In Form-Related...
http://www.thickbook.com/extra/index.html?t=fm




I tried to do as thickbook.com had instructed me, but it doesn't work...maybe I typed something in wrong?
here is what I have:



HTML:



<HTML>
<HEAD>
<TITLE>E-Mail Form</TITLE>
</HEAD>
<BODY>

<FORM method="POST" action="do_sendform.php">

<P>Your Name:<br>
<INPUT type="text" name="sender_name" size=100>
</p>

<P>Your E-Mail Address:<br>
<INPUT type="text" name="sender_email" size=100>
</p>

<P>Message:<br>
<textarea name="message" cols=50 rows=50></textarea>
</p>

<INPUT type="submit" value="Send This Form">

</FORM>

</BODY>
</HTML>




PHP:

<?php

$msg = "Sender Name:\t$_POST[sender_name]\n";
$msg .= "Sender E-Mail:\t$_POST[sender_email]\n";
$msg .= "Message:\t$_POST[message]\n\n";
$recipient = "webmaster@shplooky.com";
$subject = "Shplooky Feedback";
$mailheaders = "From: Shplooky Network <> \n";
$mailheaders .= "Reply-To: $_POST[sender_email]\n\n";
mail($recipient, $subject, $msg, $mailheaders);
echo "<HTML><HEAD><TITLE>Form Sent!</TITLE></HEAD><BODY>";
echo "<H1 align=center>Thank You, $_POST[$sender_name]</H1>";
echo "<P align=center>Your message has been sent.</P>";
echo "</BODY></HTML>";
?>



Can anyone help me????:confused:

kabatak
March 13th, 2003, 10:17
what error do you get?

marcuscable
March 13th, 2003, 12:10
It says "page cannot be found"!:(

kabatak
March 13th, 2003, 12:54
the html or the php? did you upload everything?

marcuscable
March 14th, 2003, 08:53
Yes, I did upload ALL files! The PHP file says that...

Try it at Shplooky.com (http://www.shplooky.com/show_form.html)

Thank you!:)

NONO
March 14th, 2003, 12:25
First, please make sure PHP works on your server. :p

1. PHP got error, HTML is OK:
\t (means "tab", you may delete it)

$xxx : a name start with $ is a variable.
In this sample, $xxx get data from your html form <INPUT name="xxx">, so, the name must be same.

$_POST[sender_name] is not equal to sender_name, see? ;)

========================================
FORM & PHP :

<FORM method="POST" action="CGI.php">
sender: <INPUT type="text" name="A" size=100>
email: <INPUT type="text" name="B" size=100>
message: <textarea name="C" cols=50 rows=50></textarea>
<INPUT type="submit" value="Send This Form">
</FORM>


CGI.php :
<?
$msg = "Sender Name: $A\n";
$msg .= "Sender E-Mail: $B\n";
$msg .= "Message: $C\n\n";
$recipient = "webmaster@shplooky.com";
$subject = "Shplooky Feedback";
$mailheaders = "From: Shplooky Network <> \n";
$mailheaders .= "Reply-To: $B\n\n";
mail($recipient, $subject, $msg, $mailheaders);
echo "<HTML><HEAD><TITLE>Form Sent!</TITLE></HEAD><BODY>";
echo "<H1 align=center>Thank You, $A</H1>";
echo "<P align=center>Your message has been sent.</P>";
echo "</BODY></HTML>";
?>

========================================
So, your php should be:

$msg = "Sender Name:\t$sender_name\n";
$msg .= "Sender E-Mail:\t$sender_email\n";
$msg .= "Message:\t$message\n\n";
$recipient = "webmaster@shplooky.com";
$subject = "Shplooky Feedback";
$mailheaders = "From: Shplooky Network <> \n";
$mailheaders .= "Reply-To: $sender_email\n\n";
mail($recipient, $subject, $msg, $mailheaders);
echo "<HTML><HEAD><TITLE>Form Sent!</TITLE></HEAD><BODY>";
echo "<H1 align=center>Thank You, $_POST[$sender_name]</H1>";
echo "<P align=center>Your message has been sent.</P>";
echo "</BODY></HTML>";

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
P.S. you may delete <> (in the $mailheaders line)


2. check the php file name is SAME as your html <FORM method="POST" action="do_sendform.php">


3. if can't, try to delete "\t", and then try again.
(I've ever tried to delete \t, and then OK. I don't know why.)

Good luck! :cool2:

marcuscable
March 15th, 2003, 12:07
LOL...I made a typo in the name...ROTFLMAO

Sorry!:o