Forums
This topic is locked
EASY cgi tutes please
Posted 20 May 2003 13:56:56
1
has voted
20 May 2003 13:56:56 Brownie Brown posted:
just downloaded a cgi script "formmail" Can anyone tell me where there is a tute for this for a designer not a tech-head (no offence meant tech-heads) i don't really want to have to learn all about cgi, just how to make acouple of scripts work
Any help would be much apretiated
B
.....but you can call me Brownie Brown
Edited by - Brownie13 on 20 May 2003 13:57:49
Replies
Replied 20 May 2003 21:45:00
20 May 2003 21:45:00 james crellin replied:
Hey Brownie Brown--
If I assume correctly, then you probably have Matt Wright's formmail script. I am not a "tech-head" either. My experience with that script was a pretty confusing time and I never actually got it to work. If your want to allow visitors to send simple emails to you from your site then I might suggest using a PHP script.
Use the following tutorial below to set up a formmail:
========================================================
<font color=orange><b><u>contact.html</u></b>
The First thing you need to do is create a page that will be the form for your visitors fill in. You can name it anything that you want. Something like contact.html will work just fine. </font id=orange>
<form method=post action="thanks.php"><table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="108">Your Name:</td>
<td width="192">
<input type="text" name="name">
</td>
</tr>
<tr>
<td width="108">Your E-mail:</td>
<td width="192">
<input type="text" name="thereemail">
</td>
</tr>
<tr>
<td width="108" valign="top">Your Message:</td>
<td width="192">
<textarea name="message"></textarea>
</td>
</tr>
<tr>
<td width="108"> </td>
<td width="192">
<input type="submit" name="Submit" value="Send Form">
</td>
</tr>
</table>
</form>
<font color=orange><b><u>thanks.php</u></b>
The next step is to create the PHP page that will send the information and display the "Thank you" page. So guess what I'm calling it? thanks.php
Now this is where it could seem complicated. This is the part which sends the form contents .In thanks.php I Will put the following code in: </font id=orange>
<?php
if($sentemail == "2"
{
include("sorry.php"
;
}else{
$num = $sentmessage + 1;
setcookie("sentemail","$num",time()+600); //set the cookie
$email = "Sender Name:\t$name\nSender E- Mail:\t$thereemail\nMessage:\t$message\nIP:\t$RE
MOTE_ADDR\n\n";
$to = " "; //replace this with your email address
$subject = "Refering Page"; //the subject of the email will be the refering page. Change as needed.
$mailheaders = "From: $thereemail <> \n";
$mailheaders .= "Reply-To: $thereemail\n\n";
mail($to, $subject, $email, $mailheaders);
include("thanksecho.php"
;
}
?>
<font color=orange><b><u>sorry.php</u></b>
The next page to create is the sorry.php page. This is the page that visitors will see when they have made an error in filling out your form. I suggest making this a very simple page that just tells them that there was an error and to use the back button and complete the form. </font id=orange>
<font color=orange><b><u>thanksecho.php</u></b>
Create a page called thanksecho.php This page will be the page that your visitors see after the email has been sent. This is also the page that can have a redirect or link on it so you can send them to whatever page you want. </font id=orange>
========================================================
You can view a color coded version of this tutorial at:
www.solowhost.com/tutorial_help/musicevolves_tuts/form_tut.htm
I will look for a good tutorial for the CGI formmail though and let you know what i get.
I hope that helps you out
-=- saleblitz
<img src="www.syndicprint.com/o_chacon/jtc_sig.gif" border=0>
<b>"I learn so I can help."</b> =- Saleblitz
If I assume correctly, then you probably have Matt Wright's formmail script. I am not a "tech-head" either. My experience with that script was a pretty confusing time and I never actually got it to work. If your want to allow visitors to send simple emails to you from your site then I might suggest using a PHP script.
Use the following tutorial below to set up a formmail:
========================================================
<font color=orange><b><u>contact.html</u></b>
The First thing you need to do is create a page that will be the form for your visitors fill in. You can name it anything that you want. Something like contact.html will work just fine. </font id=orange>
<form method=post action="thanks.php"><table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="108">Your Name:</td>
<td width="192">
<input type="text" name="name">
</td>
</tr>
<tr>
<td width="108">Your E-mail:</td>
<td width="192">
<input type="text" name="thereemail">
</td>
</tr>
<tr>
<td width="108" valign="top">Your Message:</td>
<td width="192">
<textarea name="message"></textarea>
</td>
</tr>
<tr>
<td width="108"> </td>
<td width="192">
<input type="submit" name="Submit" value="Send Form">
</td>
</tr>
</table>
</form>
<font color=orange><b><u>thanks.php</u></b>
The next step is to create the PHP page that will send the information and display the "Thank you" page. So guess what I'm calling it? thanks.php
Now this is where it could seem complicated. This is the part which sends the form contents .In thanks.php I Will put the following code in: </font id=orange>
<?php
if($sentemail == "2"

include("sorry.php"

}else{
$num = $sentmessage + 1;
setcookie("sentemail","$num",time()+600); //set the cookie
$email = "Sender Name:\t$name\nSender E- Mail:\t$thereemail\nMessage:\t$message\nIP:\t$RE
MOTE_ADDR\n\n";
$to = " "; //replace this with your email address
$subject = "Refering Page"; //the subject of the email will be the refering page. Change as needed.
$mailheaders = "From: $thereemail <> \n";
$mailheaders .= "Reply-To: $thereemail\n\n";
mail($to, $subject, $email, $mailheaders);
include("thanksecho.php"

}
?>
<font color=orange><b><u>sorry.php</u></b>
The next page to create is the sorry.php page. This is the page that visitors will see when they have made an error in filling out your form. I suggest making this a very simple page that just tells them that there was an error and to use the back button and complete the form. </font id=orange>
<font color=orange><b><u>thanksecho.php</u></b>
Create a page called thanksecho.php This page will be the page that your visitors see after the email has been sent. This is also the page that can have a redirect or link on it so you can send them to whatever page you want. </font id=orange>
========================================================
You can view a color coded version of this tutorial at:
www.solowhost.com/tutorial_help/musicevolves_tuts/form_tut.htm
I will look for a good tutorial for the CGI formmail though and let you know what i get.
I hope that helps you out
-=- saleblitz
<img src="www.syndicprint.com/o_chacon/jtc_sig.gif" border=0>
<b>"I learn so I can help."</b> =- Saleblitz
Replied 21 May 2003 04:51:40
21 May 2003 04:51:40 Brownie Brown replied:
Thanks alot for taking the time saleblitz,I'll check it out
.....but you can call me Brownie Brown
.....but you can call me Brownie Brown