Contact_Form
This is the PHP script that contains the function that creates the Contact form.
1| ?<?php
2|
3| function contactPage($Title, $ScriptName, $firstName, $lastName, $email, $subject, $message, $Error, $ErrorArray,$hTok, $CapA, $CapB, $CapSign, $CapAns)
4| {
5| //Bring in header
6| pageHeader("../showcase/",$Title,2,$ErrorArray);
7|
8| //Bring in master head
9| master(4);
10|
11| echo "<div id=\"content\">\n";
12| echo "<div class=\"center\">\n";
13| //Error warning area
14|
15| if($Error != "")
16| {
17| echo "<div class=\"error\">\n";
18| echo $Error;
19| echo "\n</div>\n";
20| }
21|
22| //Error warning area ends
23|
24| echo "<form id=\"contact_form\" action=\"".$ScriptName."\" method=\"post\" onsubmit=\"return ValidateSubmit(this);\" onreset=\"return ConfirmReset();\">\n";
25| echo "<table>\n";
26| echo "<tr><td colspan=\"2\" class=\"center\">Fields marked <span class=\"red\">*</span> are required</td></tr>\n";
27| echo "<tr>\n";
28| echo "<td class=\"right\"><label for=\"firstName\"><span class=\"red\">*</span>First Name:</label></td><td><div class=\"left\"><input type=\"text\" name=\"firstName\" id=\"firstName\" maxlength=\"20\" size=\"10\" tabindex=\"1\" value=\"".$firstName."\"><span id=\"FName\">-Please fill in a First Name.</span></div></td>\n";
29| echo "</tr>\n";
30| echo "<tr>\n";
31| echo "<td class=\"right\"><label for=\"lastName\"><span class=\"red\">*</span>Last Name:</label></td><td><div class=\"left\"><input type=\"text\" name=\"lastName\" id=\"lastName\" maxlength=\"20\" size=\"10\" tabindex=\"2\" value=\"".$lastName."\"><span id=\"LName\">-Please fill in a Last Name.</span></div></td>\n";
32| echo "</tr>\n";
33| echo "<tr>\n";
34| echo "<td class=\"right\"><label for=\"email\"><span class=\"red\">*</span>Email:</label></td><td><div class=\"left\"><input type=\"text\" name=\"email\" id=\"email\" maxlength=\"55\" size=\"30\" tabindex=\"3\" value=\"".$email."\"><span id=\"EmailBlank\">-Please fill in an Email Address.</span><span id=\"EmailFormat\">-Email Address is in the wrong form.</span></div></td>\n";
35| echo "</tr>\n";
36| echo "<tr>\n";
37| echo "<td class=\"right\"><label for=\"subject\"><span class=\"red\">*</span>Subject:</label></td>\n";
38| echo "<td><div class=\"left\">\n";
39|
40| //This is the array for the select box
41|
42| $arrOption = array('Select','Job Offer','Missing Feature','Technical Issue','Other');
43|
44| $intSize = 5;
45|
46| echo "<select name=\"subject\" id=\"subject\" tabindex=\"4\">\n";
47|
48| for($intKey = 0; $intKey < $intSize; $intKey++)
49| {
50| echo "<option value=\"".$arrOption[$intKey]."\"";
51|
52| if($arrOption[$intKey]==$subject)
53| {
54| echo " selected";
55| }
56|
57| echo ">".$arrOption[$intKey]."</option>\n";
58|
59| }
60|
61| echo "</select>\n";
62|
63|
64| //Select box ends here
65|
66| echo "<span id=\"SubjectDefault\">-Please select a subject.</span></div></td>\n";
67| echo "</tr>\n";
68| echo "<tr><td colspan=\"2\"><div style=\"text-align:left;margin-left:30px;\"><label for=\"message\"><span class=\"red\">*</span>Message:</label><span id=\"MsgBlank\">-Please fill in a message.</span></div></td></tr>\n";
69| echo "<tr><td colspan=\"2\"><textarea name=\"message\" id=\"message\" rows=\"10\" cols=\"40\" tabindex=\"5\">".$message."</textarea><input type=\"hidden\" name=\"token\" id=\"token\" size=\"64\" value=\"".$hTok."\"><input type=\"hidden\" name=\"script\" id=\"script\" size=\"128\" value=\"".$ScriptName."\"></td></tr>\n";
70| echo "<tr><td colspan=\"2\"><div style=\"text-align:left;margin-left:20px;\"><label for=\"captcha\"><span class=\"red\">*</span>Please fill in captcha below.</label><span id=\"CaptchaBlank\">-Please fill in a Captcha.</span><span id=\"CaptchaNum\">-Captcha needs to be a number.</span><span id=\"CaptchaWrong\">-Captcha answer is wrong.</span></div></td></tr>\n";
71| echo "<tr><td colspan=\"2\" class=\"center\">".$CapA." ".$CapSign." ".$CapB." = <input type=\"text\" name=\"capAnswer\" id=\"capAnswer\" maxlength=\"3\" size=\"3\" tabindex=\"6\" value=\"".$CapAns."\"><input type=\"hidden\" name=\"capComp\" id=\"capComp\" size=\"64\" value=\"".$CapA.",".$CapSign.",".$CapB."\"></td></tr>\n";
72| echo "<tr>\n";
73| echo "<th colspan=\"2\"><input type=\"submit\" name=\"submit\" id=\"submit\" value=\"Send Message\" tabindex=\"7\">\n";
74| echo " \n";
75| echo " \n";
76| echo " \n";
77| echo "<span class=\"js\"><input type=\"reset\" id=\"reset\" value=\"Reset\" tabindex=\"8\"></span><span class=\"njs\"><input type=\"submit\" name=\"reset\" id=\"reset\" value=\"Reset\" tabindex=\"9\"></span></th>\n";
78| echo "</tr>\n";
79| echo "<tr><td colspan=\"2\" class=\"center\"><a target=\"_blank\" href=\"../showcase/doc/Contact_Form/index_contactform.php\">See how I made this. Click the link to open a new window.</a></td></tr>\n";
80| echo "</table>\n";
81| echo "</form>\n";
82| echo "</div>\n";
83| echo "</div>\n";
84|
85| echo "<script type=\"text/javascript\">\n";
86| echo "jsShow(\"js\",\"show\");\n";
87| echo "jsShow(\"njs\",\"hide\");\n";
88| echo "</script>\n";
89|
90| //Bring in plain html code and display the ending
91| pageEnding("../showcase/");
92| }
93|
94| ?>