I have an evaluation "form-to-mail" form on my current site, which I would rather have in my database. I don't want it to be "part" of the database entries, rather that the user just is able to:
1. fill out the form
2. hit "submit"
3. A thank you kind of page appears
4. An email is sent to the admin with the info that was on that form.
I spent most of last night & today trying to do this myself. Of course it doesn't work, but I would appreciate knowing if I am at least on the right track.
Also, I did think perhaps that because I have select fields on this form that this might cause a problem? Anyway, here is what I have done so far:
in the db.cgi sub_main added:
elsif ($in{'recruit_eval'}) { if ($per_view) { &html_recruit_eval; } else { &html_unauth; } }
in the html.pl at the sub html_footer added:
print qq!| <A HREF="$db_script_link_url&recruit_eval=1"><b>Recruit Eval</b></A> |! if ($per_view);
then in the html.pl added new subs:
sub html_recruit_eval {
# --------------------------------------------------------
# Recruit Evaluation Form
$page_title = "Recruit Evaluation";
&html_page_top;
# < -- Start page text -- >
print qq|
<P><$font>Please complete the form below once your have traveled with a recruit.</FONT>
|;
# < -- End page text -->
print qq|
<P>
<form action="$db_script_url" method="POST">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
<input type=hidden name="$db_key" value="$db_key">
|;
print qq|
<table height="527" width="450" align="center">
<FONT face=Arial size=2>
<td style="border: 1 solid #3C2C20" width="450" bgcolor="#d5c6bb" height="66"><font color="#000000">1. <FONT face=Arial size=2> What is <b>your</b>
Primary NOR Guild Name</FONT>? </font></FONT><font color="#000000"><input type=text name="norname" size="30" style="background-color: rgb(234,226,225); color: rgb(0,0,0);">
</font>
<tr>
<td height="66" width="450" style="border: 1 solid #3C2C20" bgcolor="#d5c6bb"><font color="#000000"><FONT face=Arial size=2>2. What is the <b>name
of the recruit</b> you traveled with? </FONT><input name="RecruitsName" size="28" style="background-color: rgb(234,226,225); color: rgb(0,0,0);"></font></td>
</tr>
<tr>
<td height="55" width="450" style="border: 1 solid #3C2C20" ; bgcolor="#d5c6bb"><font color="#000000"><font face="Arial" size="2">3. How many
<b> times</b>
have you traveled with this recruit? </font><select name="Traveled" size="1" style="background-color: rgb(234,226,225); color: rgb(0,0,0);">
<option>Choose One</option>
<option value="0">None</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">More then 4</option>
</select> </font> </td>
</tr>
<tr>
<td height="251" width="450" style="border: 1 solid #3C2C20" bgcolor="#d5c6bb">
<p align="left"><font face="Arial" size="2" color="#000000">11. If you have anything <b>else
to add</b> that might <b> help</b> the chances of this recruit to be accepted
into *NOR/!, or any other pertinent information that might help us form
our decision for or against, please state your opinions below:</font><font color="#000000">
<textarea wrap="hard" name="AddInfo" cols="53" rows="7" style="background-color: rgb(234,226,225); color: rgb(0,0,0);"></textarea> </font> </p>
</td>
</tr>
<tr>
<td height="69" width="450" style="border: 1 solid #3C2C20" bgcolor="#d5c6bb">
<p align="center"><font face="Arial" size="2" color="#322821">The information entered
here will be kept in the strictest confidence of the Rathe Duchy
officers.</font></p>
<p align="center"><font face="Arial" size="2" color="#322821"><b>Clicking Submit</b> will forward your responses.</font></p>
</td>
</tr>
</table>
</center>
|;
print qq|
<p>
<center><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit">
<INPUT TYPE="RESET" VALUE="Reset"></center></form> |;
&html_footer;
&html_page_bottom;
}
sub html_recruit_eval_success {
#------------------------
%rec = &get_record($in{$db_key});
open (MAIL, "$mailprog") or &cgierr("Can't start mail program");
print MAIL "To: dianarae\@bellsouth.net\n";
print MAIL "From: Members Recruit Evaluation\n";
print MAIL "Subject: insert the subject line here\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "Recruit Evaluation.\n\n";
print MAIL "Primary NOR Guild Name: $norname.\n\n";
print MAIL "Recruits name is: $RecruitsName\n";
print MAIL "Traveled with Recruit: $Traveled\n\n";
print MAIL "Additional Info: $AddInfo\n\n";
close (MAIL);
}
&html_print_headers;
print qq|
## add body tags
<center><table border=1 cellpadding=5 cellspacing=3 width=500 align="center">
<tr><td colspan=2><FONT size=1><b>$html_title: Submission Complete</b></FONT> </td></tr>
<tr><td><p><center><$font_title><b>Submission Complete </b></font></center><br>
<tr>
<td width="346" style="border: 2 groove #2B0000; padding: 0" height="142" bgcolor="#d5c6bb">
<p><font size="2" face="Arial" color="#110000">Thank you for
information about this recruit. Your input is a very
important tool in determining their acceptance in to The New
OutRiders. </font></p>
<p><font size="2" face="Arial" color="#110000">If any of this
information is incorrect, or you wish to make changes, please go
back to the quiz form and change it. Most browsers will let you
use the <b>BACK</b> button right now and it should remember the
answers you typed in already. Just correct what you need to, then
submit again.</font></p>
</tr>
|;
&html_footer;
print qq| </td></tr></table></center>## add ending body tags
|;
}
I need to know if I am even on the right track here. Any input would be appreciated. Thank you.
Diana Rae
1. fill out the form
2. hit "submit"
3. A thank you kind of page appears
4. An email is sent to the admin with the info that was on that form.
I spent most of last night & today trying to do this myself. Of course it doesn't work, but I would appreciate knowing if I am at least on the right track.
Also, I did think perhaps that because I have select fields on this form that this might cause a problem? Anyway, here is what I have done so far:
in the db.cgi sub_main added:
elsif ($in{'recruit_eval'}) { if ($per_view) { &html_recruit_eval; } else { &html_unauth; } }
in the html.pl at the sub html_footer added:
print qq!| <A HREF="$db_script_link_url&recruit_eval=1"><b>Recruit Eval</b></A> |! if ($per_view);
then in the html.pl added new subs:
sub html_recruit_eval {
# --------------------------------------------------------
# Recruit Evaluation Form
$page_title = "Recruit Evaluation";
&html_page_top;
# < -- Start page text -- >
print qq|
<P><$font>Please complete the form below once your have traveled with a recruit.</FONT>
|;
# < -- End page text -->
print qq|
<P>
<form action="$db_script_url" method="POST">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
<input type=hidden name="$db_key" value="$db_key">
|;
print qq|
<table height="527" width="450" align="center">
<FONT face=Arial size=2>
<td style="border: 1 solid #3C2C20" width="450" bgcolor="#d5c6bb" height="66"><font color="#000000">1. <FONT face=Arial size=2> What is <b>your</b>
Primary NOR Guild Name</FONT>? </font></FONT><font color="#000000"><input type=text name="norname" size="30" style="background-color: rgb(234,226,225); color: rgb(0,0,0);">
</font>
<tr>
<td height="66" width="450" style="border: 1 solid #3C2C20" bgcolor="#d5c6bb"><font color="#000000"><FONT face=Arial size=2>2. What is the <b>name
of the recruit</b> you traveled with? </FONT><input name="RecruitsName" size="28" style="background-color: rgb(234,226,225); color: rgb(0,0,0);"></font></td>
</tr>
<tr>
<td height="55" width="450" style="border: 1 solid #3C2C20" ; bgcolor="#d5c6bb"><font color="#000000"><font face="Arial" size="2">3. How many
<b> times</b>
have you traveled with this recruit? </font><select name="Traveled" size="1" style="background-color: rgb(234,226,225); color: rgb(0,0,0);">
<option>Choose One</option>
<option value="0">None</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">More then 4</option>
</select> </font> </td>
</tr>
<tr>
<td height="251" width="450" style="border: 1 solid #3C2C20" bgcolor="#d5c6bb">
<p align="left"><font face="Arial" size="2" color="#000000">11. If you have anything <b>else
to add</b> that might <b> help</b> the chances of this recruit to be accepted
into *NOR/!, or any other pertinent information that might help us form
our decision for or against, please state your opinions below:</font><font color="#000000">
<textarea wrap="hard" name="AddInfo" cols="53" rows="7" style="background-color: rgb(234,226,225); color: rgb(0,0,0);"></textarea> </font> </p>
</td>
</tr>
<tr>
<td height="69" width="450" style="border: 1 solid #3C2C20" bgcolor="#d5c6bb">
<p align="center"><font face="Arial" size="2" color="#322821">The information entered
here will be kept in the strictest confidence of the Rathe Duchy
officers.</font></p>
<p align="center"><font face="Arial" size="2" color="#322821"><b>Clicking Submit</b> will forward your responses.</font></p>
</td>
</tr>
</table>
</center>
|;
print qq|
<p>
<center><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit">
<INPUT TYPE="RESET" VALUE="Reset"></center></form> |;
&html_footer;
&html_page_bottom;
}
sub html_recruit_eval_success {
#------------------------
%rec = &get_record($in{$db_key});
open (MAIL, "$mailprog") or &cgierr("Can't start mail program");
print MAIL "To: dianarae\@bellsouth.net\n";
print MAIL "From: Members Recruit Evaluation\n";
print MAIL "Subject: insert the subject line here\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "Recruit Evaluation.\n\n";
print MAIL "Primary NOR Guild Name: $norname.\n\n";
print MAIL "Recruits name is: $RecruitsName\n";
print MAIL "Traveled with Recruit: $Traveled\n\n";
print MAIL "Additional Info: $AddInfo\n\n";
close (MAIL);
}
&html_print_headers;
print qq|
## add body tags
<center><table border=1 cellpadding=5 cellspacing=3 width=500 align="center">
<tr><td colspan=2><FONT size=1><b>$html_title: Submission Complete</b></FONT> </td></tr>
<tr><td><p><center><$font_title><b>Submission Complete </b></font></center><br>
<tr>
<td width="346" style="border: 2 groove #2B0000; padding: 0" height="142" bgcolor="#d5c6bb">
<p><font size="2" face="Arial" color="#110000">Thank you for
information about this recruit. Your input is a very
important tool in determining their acceptance in to The New
OutRiders. </font></p>
<p><font size="2" face="Arial" color="#110000">If any of this
information is incorrect, or you wish to make changes, please go
back to the quiz form and change it. Most browsers will let you
use the <b>BACK</b> button right now and it should remember the
answers you typed in already. Just correct what you need to, then
submit again.</font></p>
</tr>
|;
&html_footer;
print qq| </td></tr></table></center>## add ending body tags
|;
}
I need to know if I am even on the right track here. Any input would be appreciated. Thank you.
Diana Rae