How to put a direct contact form on my page

monster061

New Member
Messages
18
Reaction score
0
Points
0
Hello,

I would like to put a contact place on my site (I really don't know how it is professionaly called) so people can input thier info in the boxes and write a message and in my case choose a model size ect (make reservations) and that info to go directly to a specified e-mail address.

Something like the one on this page:
http://www.pro-jump.co.uk/sitepage/Register-for-Pro-Jump-Elites.html

So if anyone can offer any specific help I would appretiate it

Thanks pals,
 

taekwondokid42

New Member
Messages
268
Reaction score
0
Points
0
The basic mail should work with these scripts:
HTML:
<html>
<title> Send me an e-mail!</title>
<body>
<form action="process.php" method="post">
Sent from: <input type="text"  align="center" size="35" maxlength="100" name="headers"> <br />
Subject: <input type="text" size="15" maxlength="15" name="subject" align="center"> <br />
<textarea rows="25" cols="90" wrap="physical" name="body" align="center">Put your message here</textarea><br />
<input type="submit" />
</form>
Process.php would look like this:
PHP:
<?php
$to = "towhereever@fromwhereever.com";
$subject = $_POST['subject'];
$body = $_POST['body'];
$headers = $_POST['headers'] .
    "X-Mailer: php";
if (mail($to, $subject, $body, $headers)) {
  echo("<p>Message sent!</p>");
 } else {
  echo("<p>Message delivery failed...</p>");
 }
?>
And to make other forms, just put that their name is also $subject (I think that would work) and use the other form tags. IE:<option>,<input type="checkbox">.
 
Last edited by a moderator:

mattura

Member
Messages
570
Reaction score
2
Points
18
A nice succinct reply. (edit: was referring to the reply 2 posts above)
Also note that you should make sure all the $_POST variables are clean so that your form is not (ab)used for spamming.
It is best not to give users the option of specifying the "to" or "headers", just make the subject something like an order number, and have all the users inputs concatenated in a readable way in the body.
There are probably several free contact form templates you could peruse.
 
Last edited:

monster061

New Member
Messages
18
Reaction score
0
Points
0
Thanks alot, you people are fascinating me with your good will to help others like me.

I hope I will make the thing work, thanks again.
Edit:
I didi all proper changes and then this is what I got when I tried to test the whole thing (after clicking SEND)

Warning: mail() has been disabled for security reasons in /home/monster/public_html/process.php on line 7


And then I changed the permisions, tried again and this is what I got:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@061.elementfx.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/1.3.39 Server at 061.elementfx.com Port 80


:) Now what ?
 
Last edited:

fanh1909

New Member
Messages
42
Reaction score
0
Points
0
I dunno... I don't use any PHP for my forms,only HTML.
If you are too confused, there are some sites that provide free forms, they generate the code for you and all you have to do is to put the code up on your HTML file. They might need a credit or linkback though.
Here are some of those sites:
http://www.response-o-matic.com
http://www.formspring.com
If those sites aren't useful, then just use google to search for them xD
 
Top