473,375 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,375 software developers and data experts.

insert html web page/form to sql database

hi my knowledgeable comrads

I have created a web form using html, css with the addition of some basic javascript validation. Although now im having trouble to insert this information to my local SQL database - can someone point me in the right direction please or refer me to a good example/pre written code?

I am using Vista Business operating system in conjunction with SQL server 2005 express edition, SQL server service pack 2, SQL server management studio express. SQL is installed and setup properly but really confused on how to go about inserting the web form fields in to my sql database?

my webform code is as follows;

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>webform</title>
  6. <link rel="stylesheet" href="includes/divs.css" style="text/css" />
  7. <link rel="stylesheet" href="includes/text.css" style="text/css" />
  8.  
  9. <script type="text/javascript">
  10. <!--
  11.  
  12.     function validate_form ( )
  13.     {
  14.     valid = true;
  15.  
  16.     if ( document.contact_form1.txtAmount.selectedIndex == 0 ) 
  17.     { 
  18.         alert ( "Please select how much you would like to borrow!" ); 
  19.         valid = false; 
  20.     }
  21.  
  22.     if ( document.contact_form1.txtPurpose.selectedIndex == 0 ) 
  23.     { 
  24.         alert ( "Please select purpose of loan" ); 
  25.         valid = false; 
  26.     }
  27.  
  28.     if ( document.contact_form1.txtResidentialStatus.selectedIndex == 0 ) 
  29.     { 
  30.         alert ( "Please select your residential status" ); 
  31.         valid = false; 
  32.     }
  33.  
  34.     if ( document.contact_form2.txtTitle.selectedIndex == 0 ) 
  35.     { 
  36.         alert ( "Please select an appropriate title" ); 
  37.         valid = false; 
  38.     }
  39.  
  40.     if ( document.contact_form2.txtFirstName.value == "" )
  41.     {
  42.         alert ( "Please fill in your First Name" );
  43.         valid = false;
  44.     }
  45.  
  46.     if ( document.contact_form2.txtSurname.value == "" )
  47.     {
  48.         alert ( "Please fill in your Surname" );
  49.         valid = false;
  50.     }
  51.  
  52.     if ( document.contact_form2.txtContactNumber.value == "" )
  53.     {
  54.         alert ( "Please enter a daytime contact number" );
  55.         valid = false;
  56.     }
  57.  
  58.     if ( document.contact_form2.txtEveningNumber.value == "" )
  59.     {
  60.         alert ( "Please enter an evening contact number" );
  61.         valid = false;
  62.     }
  63.  
  64.     if ( document.contact_form2.txtEmailAddress.value == "" )
  65.     {
  66.         alert ( "Please enter your email address" );
  67.         valid = false;
  68.     }
  69.  
  70.     if ( document.contact_form2.change_supplier[0].checked == false ) 
  71.     { 
  72.         alert ( "Please check 'Yes' or 'No' if you are interested in switching energy suppliers" ); 
  73.         valid = false;
  74.     } 
  75.  
  76.         if ( document.contact_form2.change_supplier[1].checked == false ) 
  77.     { 
  78.         alert ( "Please check 'Yes' or 'No' if you are interested in switching energy suppliers" ); 
  79.         valid = false;
  80.     } 
  81.  
  82.     if ( document.contact_form2.termsconditions.checked == false ) 
  83.     { 
  84.         alert ( "Please check the Terms & Conditions box." ); 
  85.         valid = false;
  86.     } 
  87.  
  88.     return valid;
  89. }
  90.  
  91. //-->
  92. </script>
  93. </head>
  94. <body>
  95. <div id="container">
  96.   <h1>Apply Now!</H1>
  97.   <p> Borrow between 2,000 and 250,000<br />
  98.     Just one short form to get the finance you need</p>
  99.   <div id="loandetails">
  100.     <p class="contentstyle1">Loan Details</p>
  101.     <span class="contentstyle2"> How much would you like to borrow? </span><span class="contentstyle1">(&pound;)</span><br />
  102.     <span class="contentstyle2">Purpose of loan</span><br />
  103.     <span class="contentstyle2">Residential Status</span> </div>
  104.   <!-- Closed loandetails div -->
  105.   <div id="inputbox1">
  106.     <form name="contact_form1" method="post" action="submit.asp" onSubmit="ValidateForm()">
  107.       <select name="txtAmount" id="txtAmount" class="inputboxstyle1" >
  108.         <option value="">Please Select</option>
  109.         <option value="2000" >&pound;2000</option>
  110.         <option value="3000" >&pound;3000</option>
  111.         <option value="4000" >&pound;4000</option>
  112.         <option value="5000" >&pound;5000</option>
  113.       </select><span class="asterisk"> * </span>
  114.       <br />
  115.       <select name="txtPurpose" id="txtPurpose" class="inputboxstyle1">
  116.         <option value="" selected="selected">Please Select</option>
  117.         <option value="Consolidation"         >Consolidation</option>
  118.         <option value="Home Improvements"     >Home Improvements</option>
  119.         <option value="Holiday"             >Holiday</option>
  120.       </select><span class="asterisk"> * </span>
  121.       <br />
  122.       <select name="txtResidentialStatus" id="txtResidentialStatus" class="inputboxstyle1" onChange="selectChange()">
  123.         <option value="" selected="selected">Please Select</option>
  124.         <option value="Home Owner"             >Home Owner</option>
  125.         <option value="Private Tenant"         >Private Tenant</option>
  126.         <option value="Housing Association" >Housing Association</option>
  127.       </select><span class="asterisk"> * </span>
  128.     </form>
  129.   </div>
  130.   <!-- Closed inputbox1 div -->
  131.   <div id="personaldetails">
  132.     <p class="contentstyle1">Personal Details</p>
  133.     <span class="contentstyle2">Title</span><br />
  134.     <span class="contentstyle2">First name</span><br />
  135.     <span class="contentstyle2">Surname</span><br />
  136.     <span class="contentstyle2">Daytime contact number</span><br />
  137.     <span class="contentstyle2">Evening contact number</span><br />
  138.     <span class="contentstyle2">Email address</span><br /><br />
  139.     <span class="contentstyle3">Would you be interested in saving up to </span>
  140.     <span class="contentstyle4">&pound;360 </span> <span class="contentstyle3">per year by switching energy suppliers?</span><br />
  141.   </div>
  142.   <!-- Closed personaldetails div -->
  143.   <div id="inputbox2">
  144.   <form name="contact_form2" method="post" action="submit.asp" onSubmit="return validate_form ( );">
  145.     <select name="txtTitle" class="inputboxstyle1" style="width:90px;">
  146.       <option value="">Select...</option>
  147.       <option value="Mr"   >Mr</option>
  148.       <option value="Mrs"  >Mrs</option>
  149.       <option value="Ms"   >Ms</option>
  150.     </select><span class="asterisk"> * </span>
  151.     <input name="txtFirstName" id="txtFirstName"  maxlength="30" class="inputboxstyle2" type="text" value="" />
  152.     <span class="asterisk"> * </span> 
  153.     <input name="txtSurname" id="txtSurname" maxlength="30" class="inputboxstyle2" type="text" value="" />
  154.     <span class="asterisk"> * </span>
  155.     <input name="txtContactNumber" id="txtContactNumber" maxlength="15"class="inputboxstyle2" type="text" value="" />
  156.     <span class="asterisk"> * </span>
  157.     <input name="txtEveningNumber"id="txtEveningNumber" maxlength="15" class="inputboxstyle2" type="text" value="" />
  158.     <span class="asterisk"> * </span>
  159.     <input name="txtEmailAddress" id="txtEmailAddress"  maxlength="50" class="inputboxstyle2" type="text" value="" />
  160.     <span class="asterisk"> * </span>
  161.     <input type="radio" style="margin-top:30px; width:15px;" name="change_supplier" class="inputboxstyle2" value="1"  />
  162.     <span class="contentstyle4">No</span>
  163.     <input  type="radio" style="margin-top:30px; width:15px;" name="change_supplier" value="0" />
  164.     <span class="contentstyle4">Yes</span>
  165.     </div>
  166.     <!-- Closed inputbox2 div -->
  167.     <div id="terms">
  168.     <input type="checkbox" name="termsconditions" style="margin-left:20px; margin-top:13px" value="yes"  />
  169.     <span class="termsstyle1">Tick here to agree to our <a href="javascript:MM_openBrWindow('pop_terms.asp');"> terms & conditions.</a> By ticking this box you agree to be contacted by a loan specialist.</span><br />
  170.     <span class="termsstyle3">Please check your details are correct before you proceed.</span><br /><br />
  171.     <input style="CURSOR: pointer"  type="image" src="http://bytes.com/images/submit.jpg" value="Submit" class="termsstyle4" name="Submit Button" title="Submit Your Application">
  172.   </form>
  173. </div> <!-- Closed terms div -->
  174. </div> <!-- Closed container div -->
  175. </body>
  176. </html>
  177.  
Jan 2 '09 #1
0 7090

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Venus | last post by:
Hi all, Newbie here!! I have 4 forms(A,B,C,D) and a thank you page for my questionnaire. People will be redirected to B or C depending on the last question's answer. B or C will redirect to D...
3
by: | last post by:
I'm picking up an 'IMPORTS' error for a simple database insert based on two input entry boxes in my form? It says an 'Imports' statement must preceede any declarations....... is this perahps the...
7
by: | last post by:
I am having trouble figuring out to call a database INSERT procedure from a simple submit form. It appears I should use the onclick event to trigger the procedure called BUT when I do this I...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
2
by: Polyhedron_12 | last post by:
I am having problems calling functions in general in VB. I keep getting alot of errors. Can anybody help me out with this? I put the error message on the same line that it says it is at. I believe...
1
by: Joe | last post by:
Hello All, I am trying to insert a record in the MS Access DB and for some reason I cannot get rid of error message, System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. ...
1
by: Ed Dror | last post by:
Hi there, I have ASP <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Guestbook.aspx.vb" Inherits="Guestbook" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
9
by: Jack | last post by:
Hi, I am gathering the input values to a form using Request.form method from the processing page. After all the data is captured, I am building sql statement out of it. Using a response.write...
5
by: .Net Sports | last post by:
I'm trying to insert records into an sql database coming from a page using the request ..form method. The table "general" has a primary key 'geid .' I get the following error: Cannot insert the...
5
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration:...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.