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 HTML Forum

Contact problem

Contact problem

Postby Ash on Wed Sep 21, 2005 2:41 pm

I borrowed this code from Phate's website I hope you don't mind if you doi'll just delete it. But How do I make it so I get the email instead of him?

Code: Select all

   <form method="post">
   Your Email: <br><input type="text" name="email" size="20" /><br /> <P>

   Subject: <br><input type="text" name="subject" size="20" /><br /> <P>
   Message: <br><textarea rows=5 cols=30 name="message"></textarea><br />
   <input type="submit" name="submit" value="Contact Me!" />
User avatar
Ash
1000+ Club
 
Posts: 1020
Joined: Wed Aug 03, 2005 6:10 pm
Location: England

Re: Contact problem

Postby Protege on Wed Sep 21, 2005 4:23 pm

Ash wrote:I borrowed this code from Phate's website I hope you don't mind if you doi'll just delete it. But How do I make it so I get the email instead of him?


You made me laugh with that. Thanks. :)

Have a read of this - obviously you'll have to change a few things, but you get the idea.. I hope.
Protege
50+ Club
 
Posts: 67
Joined: Mon Sep 19, 2005 8:05 am
Location: Scotland

Postby Ash on Wed Sep 21, 2005 8:01 pm

Ok I don't have a clue about php where do I edit?

[php]<?php

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

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

echo "You are now registered to the newsletter!";

} else { ?>

<form method="post">
Your e-mail address: <input type="text" name="email" />
<input type="submit" name="submit" value="send the mail" />

<?php } ?>[/php]
User avatar
Ash
1000+ Club
 
Posts: 1020
Joined: Wed Aug 03, 2005 6:10 pm
Location: England

Postby webmaster on Wed Sep 21, 2005 8:52 pm

Change: your@email.com to your own e-mail

Change:
Code: Select all
<input type="text" name="email" />


To:
Code: Select all
<textarea name="email"></textarea>


And it should work fine.
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 Protege on Wed Sep 21, 2005 9:17 pm

or you could use this:

Code: Select all
   <form action="<?=$PHP_SELF?>" method="post">
   Your Email: <input type="text" name="email" size="20" /><br />
   Subject: <input type="text" name="subject" size="20" /><br />
   Message: <textarea rows=5 cols=30 name="message"></textarea><br />
   <input type="submit" name="submit" value="Contact Me!" />

<?

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

$email = $_POST['email'];

   $to = "your@email.com";
   $subject = $_POST['subject'];
   $message = str_replace(array("\\","Content-Type:","bcc:","cc:","MIME-Version:",
"Content-Transfer-Encoding:","%"),"",$_POST['message']);
   mail($to, $subject, $message, "From: $email\n");
   echo "Thanks";
}

?>


Save that in the same php page or rename the forms action to a page with the php on it. Wallah!
Protege
50+ Club
 
Posts: 67
Joined: Mon Sep 19, 2005 8:05 am
Location: Scotland

Postby Ash on Wed Sep 21, 2005 9:20 pm

That never worked :( It's just for emailing links to me so I can upload renders onto a website should I just use a mailto: ?
User avatar
Ash
1000+ Club
 
Posts: 1020
Joined: Wed Aug 03, 2005 6:10 pm
Location: England

Postby Protege on Wed Sep 21, 2005 9:30 pm

which one didn't work? The both of them should...
Protege
50+ Club
 
Posts: 67
Joined: Mon Sep 19, 2005 8:05 am
Location: Scotland

Postby Ash on Wed Sep 21, 2005 9:41 pm

Ok Razz's one never worked as it gave me loads of text I never wanted and when I used yours I ended up with this. I hate freewebs.

http://www.freewebs.com/corrosiongfx/Request.htm

Is there anyother way I could try it out like a different web host?
User avatar
Ash
1000+ Club
 
Posts: 1020
Joined: Wed Aug 03, 2005 6:10 pm
Location: England

Postby Protege on Wed Sep 21, 2005 9:47 pm

Firstly, when I had a look at your source code, you've forgot the end php tag

Code: Select all
<!-- Content --><br><br>
<img src="images/hr_top.gif" width="528" height="58" border="0">

<blockquote><font face="Arial" size="2" color="#000000"><strong>
   <H3>This form is inoperational!</H3> <Provisional users can't create forms action="<?=$PHP_SELF?>" method="post">
   Your Email: <input type="text" name="email" size="20" /><br />
   Subject:&nbsp;&nbsp; <input type="text" name="subject" size="20" /><br />

   Message: <textarea rows=5 cols=30 name="message"></textarea><br />
   <input type="submit" name="submit" value="Contact Me!" />

<?

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

$email = $_POST['email'];

   $to = "your@email.com";
   $subject = $_POST['subject'];
   $message = str_replace(array("\\","Content-Type:","bcc:","cc:","MIME-Version:",
"Content-Transfer-Encoding:","%"),"",$_POST['message']);
   mail($to, $subject, $message, "From: $email\n");
   echo "Thanks";
} ?> &nbsp;</strong></font></blockquote>
<br><br><br><br><br><br>

<img src="images/hr_bot.gif" width="528" height="44" border="0">
<!-- Content -->



..And you can't run PHP on a html page..rename it to request.php ;)
Protege
50+ Club
 
Posts: 67
Joined: Mon Sep 19, 2005 8:05 am
Location: Scotland

Postby Ash on Thu Sep 22, 2005 8:10 am

You can't do that with freewebs so I just used a normal mailto: I may try it if I .com the website.
User avatar
Ash
1000+ Club
 
Posts: 1020
Joined: Wed Aug 03, 2005 6:10 pm
Location: England

Next

Who is online

Users browsing this forum: No registered users and 4 guests