Need Help Please
Posted: Mon Dec 14, 2009 9:40 pm
Hello I am creating a Form that when submitted it send the data to a .csv and then emails the .csv to the user here is what i have
The problem i have ios with the javascript also wich i used to create the combo boxes here is the .js
and it works fine in the example here which is plain html and JavaScript it just wont work with the php as shown above
Please help i need this done by Thursday for work and i cant figure this out thank you in advance
Code: Select all
<?php
session_start();
function checkEmailAddress($orgEmail) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $orgEmail)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $orgEmail);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" src="../../list.js"></script>
<style type="text/css">
<!--
table.formatTblClass {border-collapse:collapse;width:800px;border:1px solid #cccccc;background-color:#f1f1f1;}
-->
</style>
</head>
<body>
<FORM name="drop_list" action="<?=$_SERVER['../../PHP_SELF'];?>" method="POST" >
<?php
if(!isset($_POST['Submit'])){
$message = 'Fill out the form';
$aClass = 'normFrmClass';
?>
<table class="formatTblClass">
<tr>
<th colspan="6"><?=$message;?></th>
</tr>
<tr>
<td width="86"><span>First Name:</span></td>
<td width="197"><input class="<?=$aClass;?>" type="text" name="fn" id="fn" /></td>
<td width="62"><span>Last Name</span></td>
<td colspan="3"><input class="<?=$aClass;?>" name="ln" type="text" id="ln" size="50" /></td>
</tr>
<tr>
<td>School Name:</td>
<td><input class="<?=$aClass;?>" type="text" name="sn" id="sn" /></td>
<td width="197"> </td>
<td><label>Advisor:
</label></td>
<td><input type="text" name="Advisor:" id="Advisor:" /></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Address:</td>
<td colspan="5"><input name="address" type="text" id="address" size="100" /></td>
</tr>
<tr>
<td><span>City:</span></td>
<td><input type="text" name="city" id="city" /></td>
<td><span>State:</span></td>
<td width="148"><input type="text" name="state" id="state" /></td>
<td width="24"><span>ZIP:</span></td>
<td width="255"><input type="text" name="zip" id="zip" /></td>
</tr>
<tr>
<td>Phone:</td>
<td><input type="text" name="phone" id="phone" /></td>
<td>Email:</td>
<td><input class="<?=$aClass;?>" type="text" name="email" id="email" /></td>
<td><input name="emailMe" type="checkbox" id="emailMe" value="Yes" checked="checked" /></td>
<td>Please send me email</td>
</tr>
<tr>
<td>Category</td>
<td><SELECT NAME="Category" onChange="SelectSubCat();" >
<Option value="">Category</option>
</SELECT></td>
<td>Subcategory</td>
<td><SELECT id="SubCat" NAME="SubCat">
<Option value="">SubCat</option>
</SELECT> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="6"><div align="center">
<input type="submit" name="Submit" id="Submit" value="Submit" />
<input type="reset" name="Reset" id="button" value="Reset" />
</div></td>
</tr>
</table>
</form>
<p>
<?php
}//end if
?>
</p>
<p> </p>
</body>
</html>Code: Select all
function fillCategory(){
// this function is used to fill the category list on load
addOption(document.drop_list.Category, "Leadership Development", "Leadership Development", "");
addOption(document.drop_list.Category, "Occupations", "Occupations", "");
addOption(document.drop_list.Category, "Skilled and Technical Sciences", "Skilled and Technical Sciences", "");
}
function SelectSubCat(){
// ON selection of category this function will work
removeAllOptions(document.drop_list.SubCat);
addOption(document.drop_list.SubCat, "", "Please Select a Value to the Left First", "");
if(document.drop_list.Category.value == 'Leadership Development'){
addOption(document.drop_list.SubCat,"Action Skills", "Action Skills");
addOption(document.drop_list.SubCat,"American Spirit", "American Spirit");
addOption(document.drop_list.SubCat,"Chapter Business Procedure", "Chapter Business Procedure");
addOption(document.drop_list.SubCat,"Chapter Display", "Chapter Display");
addOption(document.drop_list.SubCat,"Community Service", "Community Service");
addOption(document.drop_list.SubCat,"Extemporaneous Speaking", "Extemporaneous Speaking");
addOption(document.drop_list.SubCat,"Job Interview", "Job Interview");
addOption(document.drop_list.SubCat,"Job Skill Demonstration A", "Job Skill Demonstration A");
addOption(document.drop_list.SubCat,"Job Skill Demonstration Open", "Job Skill Demonstration Open");
addOption(document.drop_list.SubCat,"Occupational Health and Safety", "Occupational Health and Safety");
addOption(document.drop_list.SubCat,"Occupational Health and Safety", "Occupational Health and Safety");
addOption(document.drop_list.SubCat,"Outstanding Chapter", "Outstanding Chapter");
addOption(document.drop_list.SubCat,"Prepared Speech", "Prepared Speech");
addOption(document.drop_list.SubCat,"Promotional Bulletin Board", "Promotional Bulletin Board");
addOption(document.drop_list.SubCat,"Quiz Bowl", "Quiz Bowl");
}
if(document.drop_list.Category.value == 'Occupations'){
addOption(document.drop_list.SubCat,"Customer Service", "Customer Service");
addOption(document.drop_list.SubCat,"Entrepreneurship", "Entrepreneurship");
addOption(document.drop_list.SubCat,"First Aid/CPR", "First Aid/CPR");
addOption(document.drop_list.SubCat,"Principles of Technology", "Principles of Technology");
addOption(document.drop_list.SubCat,"Related Technical Math", "Related Technical Math");
addOption(document.drop_list.SubCat,"Total Quality Management", "Total Quality Management");
}
if(document.drop_list.Category.value == 'Skilled and Technical Sciences'){
addOption(document.drop_list.SubCat,"3-D Visualization and Animation", "3-D Visualization and Animation");
addOption(document.drop_list.SubCat,"Advertising Design", "Advertising Design");
addOption(document.drop_list.SubCat,"Architectural Drafting", "Architectural Drafting");
addOption(document.drop_list.SubCat,"Audio/Radio Production", "Audio/Radio Production");
addOption(document.drop_list.SubCat,"Automated Manufacturing Technology", "Automated Manufacturing Technology");
addOption(document.drop_list.SubCat,"Automotive Refinishing Technology", "Automotive Refinishing Technology");
addOption(document.drop_list.SubCat,"Automotive Service Technology", "Automotive Service Technology");
addOption(document.drop_list.SubCat,"Aviation Maintenance Technology", "Aviation Maintenance Technology");
addOption(document.drop_list.SubCat,"Basic Health Care Skills", "Basic Health Care Skills");
addOption(document.drop_list.SubCat,"Broadcast News Production", "Broadcast News Production");
addOption(document.drop_list.SubCat,"Building Maintenance", "Building Maintenance");
addOption(document.drop_list.SubCat,"Cabinetmaking", "Cabinetmaking");
addOption(document.drop_list.SubCat,"Carpentry", "Carpentry");
addOption(document.drop_list.SubCat,"CNC Milling Technology", "CNC Milling Technology");
addOption(document.drop_list.SubCat,"CNC Turning Technology", "CNC Turning Technology");
addOption(document.drop_list.SubCat,"Collision Repair Technology", "Collision Repair Technology");
addOption(document.drop_list.SubCat,"Commercial Baking", "Commercial Baking");
addOption(document.drop_list.SubCat,"Computer Maintenance Technology", "Computer Maintenance Technology");
addOption(document.drop_list.SubCat,"Computer Programming", "Computer Programming");
addOption(document.drop_list.SubCat,"Cosmetology", "Cosmetology");
addOption(document.drop_list.SubCat,"Crime Scene Investigation", "Crime Scene Investigation");
addOption(document.drop_list.SubCat,"Criminal Justice", "Criminal Justice");
addOption(document.drop_list.SubCat,"Culinary Arts", "Culinary Arts");
addOption(document.drop_list.SubCat,"Dental Assisting", "Dental Assisting");
addOption(document.drop_list.SubCat,"Diesel Equipment Technology", "Diesel Equipment Technology");
addOption(document.drop_list.SubCat,"Electronics Applications", "Electronics Applications");
addOption(document.drop_list.SubCat,"Electronics Technology", "Electronics Technology");
addOption(document.drop_list.SubCat,"Firefighting", "Firefighting");
addOption(document.drop_list.SubCat,"Food and Beverage Service", "Food and Beverage Service");
addOption(document.drop_list.SubCat,"Graphic Communications", "Graphic Communications");
addOption(document.drop_list.SubCat,"Health Knowledge Bowl", "Health Knowledge Bowl");
addOption(document.drop_list.SubCat,"Health Occupations Professional Portfolio", "Health Occupations Professional Portfolio");
addOption(document.drop_list.SubCat,"Heating, Ventilation, Air Conditioning and Refrigeration", "Heating, Ventilation, Air Conditioning and Refrigeration");
addOption(document.drop_list.SubCat,"Industrial Motor Control", "Industrial Motor Control");
addOption(document.drop_list.SubCat,"Internetworking", "Internetworking");
addOption(document.drop_list.SubCat,"Major Appliance Technology", "Major Appliance Technology");
addOption(document.drop_list.SubCat,"Marine Service Technology", "Marine Service Technology");
addOption(document.drop_list.SubCat,"Masonry", "Masonry");
addOption(document.drop_list.SubCat,"Mechatronics", "Mechatronics");
addOption(document.drop_list.SubCat,"Medical Assisting", "Medical Assisting");
addOption(document.drop_list.SubCat,"Motorcycle Service Technology", "Motorcycle Service Technology");
addOption(document.drop_list.SubCat,"Nail Care", "Nail Care");
addOption(document.drop_list.SubCat,"Nurse Assisting", "Nurse Assisting");
addOption(document.drop_list.SubCat,"Photography", "Photography");
addOption(document.drop_list.SubCat,"Plumbing", "Plumbing");
addOption(document.drop_list.SubCat,"Power Equipment Technology", "Power Equipment Technology");
addOption(document.drop_list.SubCat,"Practical Nursing", "Practical Nursing");
addOption(document.drop_list.SubCat,"Precision Machining Technology", "Precision Machining Technology");
addOption(document.drop_list.SubCat,"Preschool Teaching Assistant", "Preschool Teaching Assistant");
addOption(document.drop_list.SubCat,"Residential Wiring", "Residential Wiring");
addOption(document.drop_list.SubCat,"Robotics and Automation Technology", "Robotics and Automation Technology");
addOption(document.drop_list.SubCat,"Sheet Metal", "Sheet Metal");
addOption(document.drop_list.SubCat,"TeamWork", "TeamWork");
addOption(document.drop_list.SubCat,"Tech Prep Showcase", "Tech Prep Showcase");
addOption(document.drop_list.SubCat,"Technical Computer Applications", "Technical Computer Applications");
addOption(document.drop_list.SubCat,"Technical Drafting", "Technical Drafting");
addOption(document.drop_list.SubCat,"Telecommunications Cabling", "Telecommunications Cabling");
addOption(document.drop_list.SubCat,"Television (Video) Production", "Television (Video) Production");
addOption(document.drop_list.SubCat,"Web Design", "Web Design");
addOption(document.drop_list.SubCat,"Welding", "Welding");
}
}
//////////////////
function removeAllOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
//selectbox.options.remove(i);
selectbox.remove(i);
}
}
function addOption(selectbox, value, text )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}
Code: Select all
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title>Skills Usa</title>
<script language="javascript" src="list.js"></script>
<style type="text/css">
<!--
#apDiv1 {
position:absolute;
width:200px;
height:115px;
z-index:1;
left: 4px;
top: 3px;
}
#apDiv2 {
position:absolute;
width:703px;
height:63px;
z-index:2;
left: 228px;
top: 54px;
}
-->
</style>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000" onLoad="fillCategory();">
<div id="apDiv1"><img src="Registration2010_files/image001.png" width="224" height="147" alt="Skills Usa"></div>
<p> </p>
<p> </p>
<div id="apDiv2">
<p><strong>Southwest Washington</strong><strong> Skills USA</strong><br>
<strong><u>Regional Conference Registration and Invoice</u></strong><br>
<em>Chapter Registration Deadline: <u>January 29, 2010</u></em></p>
<p><strong>*State and National Member Dues and Regional Registration must be paid before members can compete.</strong></p>
</div>
<p> </p>
<p> </p>
<p> </p>
<FORM name="drop_list" action="http://www.vansd.org/cgi-bin/FormMail.pl" method="POST" >
<table width="989" height="280" border="0">
<tr>
<th width="162" scope="row">Name:</th>
<td width="144"><input type="text" name="Name:" id="Name:"></td>
<td width="35"> </td>
<td width="147"> </td>
<td width="44"> </td>
<td width="141"> </td>
<td width="141"> </td>
<td width="141"> </td>
</tr>
<tr>
<th scope="row">School Name:</th>
<td><input type="text" name="Advisor2" id="School NSchool Name:ame:"></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th height="30" scope="row">School Address:</th>
<td><input type="text" name="School Address:" id="School Address:"></td>
<td>City:</td>
<td><input type="text" name="City" id="City"></td>
<td>State:</td>
<td><input type="text" name="State" id="State"></td>
<td>Zip-Code:</td>
<td><input type="text" name="Zip-Code" id="Zip-Code"></td>
</tr>
<tr>
<th scope="row">Advisor:</th>
<td><input type="text" name="Advisor" id="Advisor"></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th scope="row">Program:</th>
<td><input type="text" name="Program:" id="Program:"></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th scope="row">Category:</th>
<td><select name="Category" onChange="SelectSubCat();" >
<option value="">Category</option>
</select></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th scope="row">Subcategory</th>
<td><select id="SubCat" name="SubCat">
<option value="">SubCat</option>
</select></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<th scope="row"><input type="hidden" name="recipient" value="Robert.Skillings@vansd.org">
<input type="hidden" name="subject" value="Skills USA"><input type="submit" name="submitButtonName" value="Submit" tabindex="5">
</th>
<td><input type="reset" tabindex="6"></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p>
<input type="hidden" name="return_link_title" value="Return to Columbia River Home Page">
<input type="hidden" name="return_link_url" value="http://river.vansd.org/">
</p>
</form>
</body>
</html>