Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Connect a web form to access database

Connect a web form to access database

Scheduled Pinned Locked Moved JavaScript
javascriptquestionhtmlcssdatabase
3 Posts 2 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Babylon Lion
    wrote on last edited by
    #1

    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? 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 = '';
        }
    

    }

    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>
    
    R 1 Reply Last reply
    0
    • B Babylon Lion

      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? 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 = '';
          }
      

      }

      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>
      
      R Offline
      R Offline
      Ravi Sant
      wrote on last edited by
      #2

      Microsoft Access database is very Heavy and not recommended. PHP + MySQL is recommended. You can easy learn yourself: DB Connect[^] Insert Data[^] MySQL Select[^]

      B 1 Reply Last reply
      0
      • R Ravi Sant

        Microsoft Access database is very Heavy and not recommended. PHP + MySQL is recommended. You can easy learn yourself: DB Connect[^] Insert Data[^] MySQL Select[^]

        B Offline
        B Offline
        Babylon Lion
        wrote on last edited by
        #3

        Yeah that's what I ended up doing :) Thanx for the reply though!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups