Hello all,

I have a simple web form that use an email address to send information once it's submitted. I need to modify it to where it sends the info to an access database. How can I make that happen?

web form:

<?xml version="1.0" encoding="UTF-8" ?>

<!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" xml:lang="en" lang="en">

<head>
	<title>Untitled</title>
	<link href="wireless.css" rel="stylesheet" type="text/css"/>   
	<script type="text/javascript" src="form.js"></script>
</head>

<body onload="addOption_list(); addOption_list2(); divSelection()" >

   <div id="outer">
   	<img src="" alt="logo" usemap="#logomap" class="carrierLogo" />
	  <map id="logomap" name="logomap">
		<area shape="rect" coords="0,0,399,120" href="#" alt="home"/>
	  </map>
	  
   <div id="inner">	
	<form id="apply" name="apply" action="mailto:info@donate.com" method="post" enctype="text/plain">
	
	<fieldset>
	 	<legend>Donor Type</legend>
		   <label for="donerType">
		     <input type="radio" id="businessDoner" name="donerType"  value="business" checked="checked" onclick="toggle(this); " />
		   		  Business
		   </label>
		   
		   <label for="donerType">
		   	 <input type="radio" id="individualDoner" name="donerType" value="individual" onclick="toggle(this)" />
		   		  Individual
		   </label>
	 </fieldset>
	 
	 
	 <fieldset id="contact" >
	 	<legend>Donor Information</legend>
	 	<div id="busi" >
			  <label class="blockLabel" for="companyName">
				Company Name<span>*</span>
				<input type="text" id="companyName" name="companyName" />
			  </label>
			  
			  <label class="blockLabel" for="contactName">
		 		Contact Name<span>*</span>
				<input type="text" id="contactName" name="contactName" />
			  </label>  
			  
			  <label class="blockLabel" for="phone">
				Phone
				<input type="text" id="phone" name="phone" />
			 </label>
		
			  <label class="blockLabel" for="email">
		 		Email<span>*</span>
				<input type="text" id="email" name="email" />
			  </label> 
			
			 <label class="blockLabel" for="street">
				Street Address<span>*</span>
				<input type="text" id="street" name="street" />	
			 </label>
				
			 <label class="indentLabel" for="city">
		 		City<span>*</span>
		 		<input type="text" id="city" name="city" />
			 </label>
			
			 <label for="state">
				State<span>*</span>
		 		<input type="text" id="state" name="state" maxlength="2" />	
			 </label>
			
			 <label for="zip">
				ZIP<span>*</span>
				<input type="text" id="zip" name="zip" maxlength="10" />
			 </label><br/><br/>
			 
			 <label for="quantitys">
				Computer Quantity<span>*</span>
				<select id="quantitys" name="quantitys"  >
					<option value=""></option>
				</select>
			 </label>
	    </div>
	 	
                <div id="ind" style="display: none" >
			  <label class="blockLabel" for="firstName">
				First Name<span>*</span>
				<input type="text" id="firstName" name="firstName" />
			  </label>
			  
			  <label class="blockLabel" for="lastName">
		 		Last Name<span>*</span>
				<input type="text" id="lastName" name="lastName" />
			  </label>  
			  
			  <label class="blockLabel" for="phone">
				Phone
				<input type="text" id="phone" name="phone" />
			 </label>
		
			  <label class="blockLabel" for="email">
		 		Email<span>*</span>
				<input type="text" id="email" name="email" />
			  </label> 
			
			 <label class="blockLabel" for="street">
				Street Address<span>*</span>
				<input type="text" id="street" name="street" />	
			 </label>
				
			 <label class="indentLabel" for="city">
		 		City<span>*</span>
		 		<input type="text" id="city" name="city" />
			 </label>
			
			 <label for="state">
				State<span>*</span>
		 		<input type="text" id="state" name="state" maxlength="2" />	
			 </label>
			
			 <label for="zip">
				ZIP<span>*</span>
				<input type="text" id="zip" name="zip" maxlength="10" />
			 </label><br/><br/>
			 
			 <label for="quantity">
				Computer Quantity<span>*</span>
				<select id="quantity" name="quantity"  >
					<option value=""></option>
				</select>
			 </label>
	  </div>
	 </fieldset>

	 
	 <div>
		<label for="submitBtn">Submit <input type="button" value="Submit" onclick="submitForm();" id="submitBtn"/></label>
		&nbsp;&nbsp;&nbsp;&nbsp;<label for="cancelBtn">Cancel <input type="reset" value="Cancel"  id="cancelBtn"/></label>
	</div>
	
	</form>
	
</div>
</div>
</body>
</html>

javascript file:

//collects the data
 function submitForm() {
	document.getElementById('apply').submit();
        clearForm();
}
//clears the form
 function clearForm(){

  	var i;
        for (i = 0; (i < document.forms.length); i++) {
         document.forms[i].reset();
  }
}

//create the  drop down list
function addOption(selectbox,text,value ){
	var optn = document.createElement("option");
	optn.text = text;
	optn.value = value;
	selectbox.options.add(optn);
}

function addOption_list(){
	var quan = new Array("1","2","3","4","5+");
	for (var i=0; i < quan .length;++i){
	
	addOption(document.apply.quantity, quan[i], quan[i]);
	}
}

function addOption_list2(){
	var quan = new Array("1","2","3","4","5","6","7","8","9","10+" );
	for (var i=0; i < quan.length;++i){
	
	addOption(document.apply.quantitys, quan[i], quan[i]);
	}
}

//switches between divs when one of the radio button is checked
  function toggle(obj) {
    var busDiv = document.getElementById('busi');
    var indDiv = document.getElementById('ind');

        if (obj.value == 'business'){
            busDiv.style.display = '';
            indDiv.style.display = 'none';
        }          
        else{
            busDiv.style.display = 'none';
            indDiv.style.display = '';
        }
      	                      
  }

Recommended Answers

All 3 Replies

As 'Agarsia' said, you would need to learn a different language for that, and I agree, PHP & MySql is a good choice...

When you are using Microsoft Access databasen, its very simple to config, but much "heavier".

Learn yourself:
Connecting to a mysql-database.
INSERT INTO.

then use the SELECT command to get out the data from the database.

Hope this helps!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.