It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

Form & E-mail

Moderator: Malcolm

Form & E-mail

Postby lms on Sat Jul 23, 2005 11:31 pm

Hey all its me again,

I made a form, but i would like that to mail to my inbox. In nice looging mail. Orded if you now what i main.

This is my form code.
Code: Select all
<form name="form1" method="post" action="http://mylink/test:)">
  <p>
    <textarea style="background-color:#0099FF "name="E-mail" id="E-mail"></textarea>
    <input  style="background-color:#0099FF "type="submit" name="Submit" value="GO!">
</p>
</form>

I know ive got to make somthing in php but the only problem is i dont know what i must make in it.
Can some one help ?

Thanks,
lms
lms
 
Posts: 9
Joined: Sat Jul 23, 2005 8:26 pm

Postby webmaster on Sat Jul 23, 2005 11:58 pm

Do you have support for ASP or PHP on your webserver?

And welcome to DEVPPL.
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby lms on Sun Jul 24, 2005 12:03 am

Thanks :D
And yes i have php and asp support on my website.
lms
 
Posts: 9
Joined: Sat Jul 23, 2005 8:26 pm

Postby webmaster on Sun Jul 24, 2005 12:20 am

Ok, let me write you a simple PHP-script for this:
[php]<?php

if(isset($_POST['submit'])) {

$to = $POST['to'];
$subject = $_POST['subject'];
$message = $_POST['message'];
mail($to, $subject, $message);

echo "Your mail has been sent!";

} else { ?>

<form method="post">
To: <input type="text" name="to" /><br />
Subject: <input type="text" name="subject" /><br />
Message: <textarea name="message"></textarea><br />
<input type="submit" name="submit" value="send the mail" />

<?php } ?>[/php]

I just wrote it here so I haven't been able to test it, but I hope it should work.
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby lms on Sun Jul 24, 2005 11:36 am

were do i put my e- mail adderes ?
lms
 
Posts: 9
Joined: Sat Jul 23, 2005 8:26 pm

Postby webmaster on Sun Jul 24, 2005 12:06 pm

If you add that code I posted into page.php and then run it, wou will get a form with 3 fields, to, subject and message. Enter the email adress you want to send the mail to, in the To:-field. If you allways want the e-mail to be the same, use this script instead:

[php]<?php

if(isset($_POST['submit'])) {

$to = "your@mail.com";
$subject = $_POST['subject'];
$message = $_POST['message'];
mail($to, $subject, $message);

echo "Your mail has been sent!";

} else { ?>

<form method="post">
Subject: <input type="text" name="subject" /><br />
Message: <textarea name="message"></textarea><br />
<input type="submit" name="submit" value="send the mail" />

<?php } ?>[/php]

And just change your@mail.com to your own email.
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby lms on Sun Jul 24, 2005 1:53 pm

webmaster wrote:If you add that code I posted into page.php and then run it, wou will get a form with 3 fields, to, subject and message. Enter the email adress you want to send the mail to, in the To:-field. If you allways want the e-mail to be the same, use this script instead:

[php]<?php

if(isset($_POST['submit'])) {

$to = "your@mail.com";
$subject = $_POST['subject'];
$message = $_POST['message'];
mail($to, $subject, $message);

echo "Your mail has been sent!";

} else { ?>

<form method="post">
Subject: <input type="text" name="subject" /><br />
Message: <textarea name="message"></textarea><br />
<input type="submit" name="submit" value="send the mail" />

<?php } ?>[/php]

And just change your@mail.com to your own email.


wow thank you verry mutch (k) :oops:
lms
 
Posts: 9
Joined: Sat Jul 23, 2005 8:26 pm

Postby lms on Sun Jul 24, 2005 2:08 pm

I'm a bad bad bad man :p

I get an error
Warning: Failed to connect to mailserver, verify your "SMTP" setting in php.ini in ** on line 8.

So sorry :oops:
Need help
lms
 
Posts: 9
Joined: Sat Jul 23, 2005 8:26 pm

Postby webmaster on Sun Jul 24, 2005 3:00 pm

This is something you have to talk with your webhost about, is seems like you don't have any mailserver installed, which you must have to make this function work.
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby Phate on Wed Aug 03, 2005 4:37 pm

I am using this code...

When the person fills out the info and hits send, it says that the email was sent

But, i dont get any emails...
Web-Developing since '03
Image
User avatar
Phate
500+ Club
 
Posts: 826
Joined: Sun Nov 21, 2004 4:12 am
Location: 127.0.0.1

Next

Who is online

Users browsing this forum: No registered users and 1 guest