PDA

View Full Version : How do i make a form


undacuvabruva
12-06-2004, 01:58 AM
I need a form that the results will be sent to my email address.
Any body have a clue how to do this?

688206002
12-06-2004, 02:13 AM
Originally posted by undacuvabruva@Dec 5 2004, 08:58 PM
I need a form that the results will be sent to my email address.
Any body have a clue how to do this?
15584



1. Create a HTML form

2. On the page where the form submits to,

$sender=$_POST['email'];
$sendername=$_POST['name'];
$subject=$_POST['subject'];
$content="$sendername of $sender has sent the following message: \n\n" . $_POST['content'];
mail("admin@688206002.hostmatrix.org", $subject, $content);
echo "Your form has been submitted. The staff will try to contact you ASAP!<br><br>";



Obviously, edit to fit needs.

undacuvabruva
12-06-2004, 02:31 AM
... where do I put that code?
you mean the site in the, <form action="site"> ?

688206002
12-06-2004, 02:43 AM
Originally posted by undacuvabruva@Dec 5 2004, 09:31 PM
... where do I put that code?
you mean the site in the, <form action="site"> ?
15592


No, make a page where the HTML form would be.
Make the form submit to... say, formsubmit.php (change to whatever you want)
Make sure that the text field where the sender inputs his/her email address is called "email", name, "name", and subject, "subject." The textarea where the body of the msg would be should be named "content."

Put the code posted above inn the formsubmit.php page.


EDIT:
Make the form method "post" not "get".

undacuvabruva
12-06-2004, 02:23 PM
I know this is wrong
but heres what i got.
I need to know how to fix it

It sends me an email. but it has no conent, all it says is
of has sent the following message:


http://www.kbdezigns.hostmatrix.org/eform.php
that's where it's at

<?php
$sender=$_POST['email'];
$sendername=$_POST['firstname'];
$subject=$_POST['subject'];
$content="$sendername of $sender has sent the following message: \n\n" . $_POST['content'];
mail("kbdezigns@gmail.com", $subject, $content);
echo "Your form has been submitted. The staff will try to contact you ASAP!<br><br>";
echo "<form method='post' enctype='text/plain' class='black'>
<input type='hidden' name='content'>
<div class='black'>
First Name<br>
<input type='text' name='firstname' size='50' maxlength='100'><br><br>
Last Name<br>
<input type='text' name='lastname' size='50' maxlength='100'><br><br>
E-mail address:<br>
<input type='text' name='email' size='50' maxlength='100'><br><br>
Site Name:<br>
<input type='text' name='sitename:' size='50' maxlength='100'><br><br>

Brief Site Description:<br>
<textarea name='descript' rows=7 cols=30></textarea>

<br><br>Do you agree to the ToS? <a href='/services/tos.html' class='up'>Link</a>:<br>
<input type='radio' name='yes'value='Yes'>Yes<BR>
<input type='radio' name='no'value='No'>No<br>
</div>
<input type='submit' value='Submit'><img src='spacer.gif' width=5 height=1 alt='spacer'>
<input type='reset' value='Reset'></form>";
?>

mahangee
12-06-2004, 03:11 PM
What is "$_POST['content'];" and $_POST['subject']; looking for? As nothing through the form is sent under those names.

I dunno whats causing the error but you could try a few things :D First of all make the forms action $_SERVER['PHP_SELF']; and try making the 2 post variables I mentioned early have some value. Then come back and tell us if there is still any errors.

EDIT: And why do you use ' for HTML values I thought you had to use "?

And I edited your posted to make the link you gave us work :D

mck9235
12-06-2004, 10:54 PM
There is a script in script library called: Script generator, or something of that nature. I tired it out, it works well enough for you basic needs, sends results to your E-mail.

Tim
12-06-2004, 11:22 PM
I should reccomend DynaForm (http://www.webligo.com/products_dynaform.php) Just edit the script a bit, then make an html form with the action as dynaform.php, and the method of POST. It'll send you an email, and though they're not the prettyest, they have every piece of information that you could need. Easy, and effective.

Tim :)

undacuvabruva
12-07-2004, 02:14 AM
That dynaform is awsome.
Thanks