FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Contact Script





riv
You know those e-mail forms on webpages, where you type your subject and message, a script sends your words via e-mail to somewhere?

I want one of those to put on my website. I have used mailto thingys, but they are obtrusive, and they won't work on setups without an e-mail client, or don't understand the mailto: protocol.

I realize that there are free services that provide e-mail forms, but to my knowledge, they require payment, or an ad (gasp!), and they have annoying setup processes that are supposed to "help" you in making a e-mail form.

I believe that those e-mail form scripts are simple. Correct me if I'm mistaken. If the script is really simple, I would appreciate it if someone walked me through making one, made me a script (out of the genourisity of his/her heart Smile ), or pointed me somewhere else on the internets. I know (X)HTML CSS really well (in my opinion), and some PHP. If the script is really complicated, post it here so that a Moderator could know and kindly move it into the Marketplace. Smile
benjad
really detailed, but highly rated...

http://www.phpfreaks.com/tutorials/130/0.php
riv
Thanks, I'll check the article out.
wumingsden
are you still interest in a script after looking at that lovely 10-paged tutorial ? Very Happy
If not I can PM you a script that I use, want to try it out ?
riv
Ah, 10 pages of technical hard-core coding instructions filled with non-sensical PHP scripts that have a sweet spot for giving out random errors? It's just some light reading.

Anyways, thanks for offering your script. The one I attempted just sends blank messages (eg: From: "" Message: ""). That was after I made it stop sending error messages. (I wasted 30 minutes just because I fogot that file names were case-sensitive...)

In short, yes, I would really appreciate your script so I can study it and modify it. That is, after I get rid of the infinite pile of blank messages in my inbox... Wink
mathiaus
The PHP mail() function is rather easy and should be more than sufficent.
http://uk.php.net/function.mail

Example code wrote:
Code:
<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
   'Reply-To: webmaster@example.com' . "\r\n" .
   'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>


you can of course change it so the inputs are gathered from a form, validated etc.

my short and sweet version Smile
Code:
<?php
if($_POST['submit']) {
   $email = "me@something.com";    // Your Email - set your email here
   $yname = "me";    // Your name - set your name here
   $subject = "Feedback";          // Subject - set your subject here
   // Other inputs from form
   $from = $_POST['name'];
   $fromemail = $_POST['email'];
   $message = $_POST['comment'];
   
   // headers
   $headers .= 'To: '.$yname.' <'.$email.'>' . "\r\n";
   $headers .= 'From: '.$from.' <'.$fromemail.'>' . "\r\n";
   $headers .= 'Reply-To: '.$from.' <'.$fromemail.'>' . "\r\n"
   
   // try to send
   if (mail($email, $subject, $message, $headers)) {
      $formdetails = "Feedback succesfully sent!";
   } else {
      $formdetails = "Problem sending mail.";
   }
   
   // display whether it send or not
   echo "<span style=\"color: #ff0000; font-weight: bold;\">".$formdetails."</span>";
   
?>
<form name="feedback" action="" method="post">
Name: <input name="name" />
<br />Email: <input name="email" />
<br />Comment: <textarea name="comment" rows="2" columns="10"></textarea>
<br /><br /><button name="submit" type="submit">Send Feedback</button>
</form>


Pastebins down Sad
DanielXP
Some good features

* Email validation
* Field validation
* Sends IP

http://dragracingrevolution.hostmatrix.org/forum/viewtopic.php?t=97
riv
The varibles are coming out blank for me. I am using $_POST[''], but it turns out blank. I've uploaded the code to the frihost pastebin. The PHP file is here, and the HTML file is here. (Whoops, I used PHP syntax highlighting for HTML...)
mathiaus
It's your form. Use name instead of id.
http://frihost.pastebin.com/717711

for the length of the inputs you should be using size="" and for the textarea, cols="" and rows=""
http://www.w3.org/TR/html4/interact/forms.html#h-17.7
NG
www.rmb-forum.net.tc theres a contact script there made by Leo Smile
enjoy
DanielXP
Pluscontact 1.4 is coming out on that site soon.
Related topics
Web Mailer, Create a "contact us" mailer
Inserting data to MYSQL with a PHP script
CGI FormMail Script Part II
[php] travel agency script alike
Contact page without outlook
does anyone know the contact script and the comment pages
vraagje : contact script
Script execution problem
Need to change .pl style
For those who need a contact form
PHP script installation for $4 or FRIH$ 30 (Worth $1000)
PHP contact script...
contact form with IP feature ?
Submit Picture form script
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.