The quick and dirty solution is to add the email subscribe form in the
add_success.html template file.
Replace the following input fields:
Code:
<input name="email" size=15>
<input name="name" size=15>
with the following:
Code:
<input name="name" value="<%Contact Name%>" size=75>
<input name="email" value="<%Contact Email%>" size=75>
Well, what you would have to do is the following...(to allow users to add their email to the email.db file from the add.cgi script)...(And before doing this...make sure that you keep a backup of your add.cgi, email.db, and links.db files)...
1) COPY the following codes:
Code:
my $action = $in{'action'};
CASE: {
($action eq "subscribe") and do { &subscribe (%in); last CASE; };
($action eq "unsubscribe") and do { &unsubscribe(%in); last CASE; };
&site_html_mailing();
};
and PASTE them into your
sub main routine in your
add.cgi script.
2) Then copy the rest of the
subscribe.cgi script into your
add.cgi script. In the new subs that you put in the
add.cgi, replace all occurences of the following:
Code:
my $email = $in{'email'};
with the following:
Code:
my $email = $in{'Contact Email'};
AND
Code:
my $name = $in{'name'};
with the following:
Code:
my $name = $in{'Contact Name'};
3) Then in your
add_html template file, add the following codes:
Code:
Subscribe/Unsubscribe from our Site Newsletter:
<select name="action">
<option value="subscribe"> Subscribe</option>
<option value="unsubscribe"> Unsubscribe</option>
</select>
4) Then in the
sub site_html_add_failure routine, add the following codes:
Code:
if ($in{'action'} eq 'subscribe') {
$subscribe .= qq|
<select name="action">
<option value="subscribe" SELECTED> Subscribe</option>
<option value="unsubscribe"> Unsubscribe</option>
</select>
|;
}
if ($in{'action'} eq 'unsubscribe') {
$subscribe .= qq|
<select name="action">
<option value="subscribe"> Subscribe</option>
<option value="unsubscribe" SELECTED> Unsubscribe</option>
</select>
|;
}
at the top of this sub.
Then define the following tag in this sub.
Code:
subscribe => $subscribe
5) Add the following codes in your
add_failure.html routine:
Code:
Subscribe/Unsubscribe from our Site Newsletter:
<%subscribe%>
6) Then in your
sub site_html_add_failure file add the following codes:
Code:
if ($in{'action'} eq 'Yes') {
$subscribe .= qq|Yes|;
}
elsif ($in{'action'} eq 'No') {
$subscribe .= qq|No|;
}
else {
$subscribe .= qq|You are not subscribed to our Newsletter|;
}
Define the following tag:
Code:
subscribe => $subscribe
7) Then in your
add_success.html, add the following codes:
Code:
Subscribe: <%subscribe%>
That should do it...there may be some bugs, but we can squash them...
Regards,
------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com * Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.