Yeah that's what I ended up doing :) Thanx for the reply though!
Babylon Lion
Posts
-
Connect a web form to access database -
Connect a web form to access databaseHello 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>
-
Sorted Linked List [modified]I wasn't sure which lines were relevant but I knew I had a problem reading the file in main.
-
Sorted Linked List [modified]Thank you all for the replies. I modified the code, and now it compiles ans run with no errors. But it doesn't output anything?! Any clue?
import java.io.*;
import java.util.*;public class mainStudnetProg
{
public static void main(String[] args)
{
StudentList studentList = new StudentList();try { Scanner infile = new Scanner(new FileReader("C:\\\\studentInfo.txt")); createStudentList(infile, studentList); } catch (FileNotFoundException fnfe) { System.out.println(fnfe.toString()); } } // end main public static void createStudentList(Scanner infile, StudentList studentList) { String fName; String lName; int id; Student newStudent; while (infile.hasNextLine()) { if (!infile.hasNextLine()){ break; } infile.hasNextLine(); fName = infile.nextLine(); // If there's no line, then break out of the loop. if (!infile.hasNextLine()){ break; } infile.hasNextLine(); lName = infile.nextLine(); if (!infile.hasNextInt()){ break; } infile.hasNextInt(); id = infile.nextInt(); if (!infile.hasNextLine()){ break; } infile.hasNextLine(); infile.nextLine(); newStudent = new Student(); newStudent.setStudentInfo(fName, lName, id); studentList.insertFirst(newStudent); } }
}
-
Sorted Linked List [modified]hi all, I'm working on a program that suppose to read data from a text file and then creates a linked list and outputs the data sorted by last name. But I'm getting the following errors:
Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Unknown Source)
at mainStudnetProg.createStudentList(mainStudnetProg.java:36)
at mainStudnetProg.main(mainStudnetProg.java:15)Where is the problem?! main
import java.io.*;
import java.util.*;public class mainStudnetProg
{
public static void main(String[] args)
{
StudentList studentList = new StudentList();try { Scanner infile = new Scanner(new FileReader("C:\\\\studentInfo.txt")); createStudentList(infile, studentList); } catch (FileNotFoundException fnfe) { System.out.println(fnfe.toString()); } } // end main public static void createStudentList(Scanner infile, StudentList studentList) { String fName; String lName; int id; Student newStudent; while (infile.hasNext()) { fName = infile.nextLine(); lName = infile.nextLine(); id = infile.nextInt(); infile.nextLine(); newStudent = new Student(); newStudent.setStudentInfo(fName, lName, id); studentList.insertFirst(newStudent); } }
}
modified on Friday, November 26, 2010 10:59 PM
-
Sort Functionsthank you :)
-
Sort FunctionsSo whenever a comparison like that is required, a bubble function is used, right?
-
Sort FunctionsHi all, I have a working program that reads stocks symbols and values from a text file and do some operations on the data, and then it outputs the the data as two reports. The first report is sorted by stock symbols, and the other report is sorted by percent gain/loss. I'm having difficulties understating how these sort functions are doing the comparisons.. Can you guys provide some explanation please?
//sorts the stocks naturally (stock symbol)
template<class elemType>
void listType<elemType>::sort(){
int i, j;
int min;
elemType temp;for (i = 0; i <length; i++){ min = i; for (j = i + 1; j < length; ++j) if (list\[j\] < list\[min\]) min = j; temp = list\[i\]; list\[i\] = list\[min\]; list\[min\] = temp; }
}
//sorts the stocks by percent gain/loss
void stockListType::sortByGain(){
int i, j;
int temp;
indexByGain = new int[length];//Pre-populate the index array for(int c = 0; c < length; c++){ indexByGain\[c\] = c; } //Sort by the percentage change for (i = 0; i <length; i++){ for (j = i + 1; j < length; j++){ if (list\[indexByGain\[j\]\].getPercentChange() > list\[indexByGain\[i\]\].getPercentChange()){ temp = indexByGain\[i\]; indexByGain\[i\] = indexByGain\[j\]; indexByGain\[j\] = temp; } } }
}