|
Well, it took me hours and hours but here's how to make your feedback submitted via your email address.
I'm going to try to make this as easy as possible to describe.
Before I continue, you need to have a site that is hosted on a sever with PHP. It's a new language that works with HTML. If you don't know if it does or not, you should contact your server administrator or web hosting company. If you have a free site on Yahoo GeoCities, and some other free hosting plans, PHP script will NOT work. Sorry.
If you still want to try this even if your not sure if your sever supports PHP, you can go ahead and do this, but it may be a waste of your time. Most severs DO have PHP, so you should be ok.
Anyway, here's what to do.
For the sake of this document, make a test folder on your server. You can change the directory (folder) of all this later.
Example: www.fakesite.com/test
Create a new HTML document.
Copy this text, save it as "index.html" and upload it to the "test" folder (directory).
<html>
<head>
<title> Your Title </title>
</head>
<body>
<center><big><b><br>
Submit Your Email, Get Our Newsletter!</b></big></center>
<p><br>
</p>
<p><br>
Submit your e-mail address and you will start to receive this site's Newsletter! </p>
<p> </p>
<form action="http://www.fakesite.com/test/newsletter.php"
method="post"> <br>
<p> Your email address:<br>
<input name="email" size="60" type="text"> <br>
</p>
<p> <input value="Send" type="submit"> <input value="Clear"
type="reset"> </p>
</form>
</body>
</html>
Now, this text was used for the purposes of submitting your email address to get my site's newsletter. Your welcome to add boxes for comments, images, or whatever later.
If you choose to change where you put these files, that's fine, but make sure everything has the correct URL. It’s also a good idea to keep them in the same folder. It’s not required, but it’s a good idea.
You will create the document "/forum/newsletter.html" next.
You can also change the name "/forum/newsletter.html" to whatever, but just remember to change it in all the files.
You can also go back later and add whatever images/text/content you want. This is just the basic code.
Now, open your word processor.
Copy this text:
<?php
$subject = 'Subject of email'; // Subject of email sent to you.
$emailadd = 'youremail@fakesite.com'; // Your email address. This is where the form information will be sent.
$url = 'http://www.fakesite.com/test/thanks'; // Where to redirect after form is processed.
$req = '1'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
Above the line, "Do not edit below this line", you will see where you can put a subject for the message. You also need to put your email address that you want the form/feedback to be sent, and the page that you want visitors to be redirected to. For this, keep http://www.fakesite.com/test/thanks as the redirect page for now.
Save this as a text file; name can be whatever you want. Upload to your server, and change the name you gave it to "/forum/newsletter.html".
Now, create the folder (directory) "thanks" in the "test" directory.
Example: www.fakesite.com/test/thanks
Again, you can also go back later and add whatever images/text/content you want. This is just the basic code.
Make a new HTML document, and copy this:
<html>
<head>
<title>Thank you!</title>
<head>
<body>
Thank you for submitting your email address. You will now start to get our newsletter.
<br>
You may now return to our homepage
</body>
</html>
Save it as "index.html" and upload it to the "thanks" folder.
It is not neccessary to have a “Thank you page”, but it lets users know that it was submitted properly.
You may also want a link back to your homepage, on this page, because clicking “Back” can be a real pain for visitors of your site.
And that’s all you have to do. I know it’s a lot. But I had to read through all this crap online to get this. Talk about a pain in the butt!
If you appreciated this help, please visit my website (not an HTML help site, just a funny site), at www.derekperrone.com. Please tell your friends too!
|
|
|
|
|
|
|
// |