Submit button to MySQL database?

Ads
 

Submit button to MySQL database?

Need help linking html code to mysql database

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<p>
<font size="10">Dealer Information </font>
</p>

<form>
Dealer name: <input type="text" name="Name" /><br />
Business Center: <input type="text" name="Business_Center" /><br />
Province: <input type="text" name="Province" /><br />
Dealer Code: <input type="text" name="Dealer_Code" /><br />
City: <input type="text" name="City" /><br />
State: <input type="text" name="State" /><br />
Level: <input type="text" name="Level" />
</form> 
<td><input type="submit" name="Submit" value="Submit"></td>
</body>
</html>


<%
String BusinessCenter=request.getParameter("Business_Center");
String Name=request.getParameter("Name");
String Province=request.getParameter("Province");
String DealerCode=request.getParameter("Dealer_Code");
String State=request.getParameter("State");
String City=request.getParameter("City");
String Level=request.getParameter("Level");


try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/Parts","root";, "admin");
Statement st=connection.createStatement();
int i=st.executeUpdate("insert into data(Businss_Center,Name, Province, Dealer_Code, State, City, Level) values('"+Name+"','"+Business_Center+"','"+Province+"','"+
        Dealer_Code+"','"+State+"','"+City+"','"+Level+"')");
out.println("inserted successfully");
}
catch(Exception e){}
%>
View Answers

Ads









Related Tutorials/Questions & Answers:
Submit button to MySQL database?
Submit button to MySQL database?
Advertisements
How to save form fields into the MySql Database without submit button in jsp?
submit button
Retrive only requird data from a table in MYSQL databade to JSP file..on a field submit button.
JSP Submit Button
image on submit button
Upgrading databases between MySQL 5.0 to MySQL 5.5
Disabling submit button using jQuery
Submit comments in database when user clicks on submit button
How can we submit a form without a submit button?
Struts application two submit button
On Click on Submit Button Display Data on Orderlist
browse and submit the excel sheet into mysql as a table
Click On Images of Submit Button Perform Action
storing details in database on clicking submit button - JSP-Servlet
need help....how to connect and disconnect multiple databases(databases created in mysql) using java and my sql
Facing Problem with submit and cancel button in same page - Struts
Databases
PHP HTML Form Submit Button
how to disable submit button in jsp using servlet when some condition is satisfied
JSP Radio Button MySQL insert - JSP-Servlet
create text box by clicking button and submittong text in text box using submit
Action Submit Html
insertin form data into databse and blank all form field when click on submit button
submit a form
PHP Make a shoutbox without using MYSQL Tutorial
Export data in excel sheet via Browse and upload button into mysql database
inserting image in mysql database using browse button in servlets
MySQL Client
MySQL Client

Ads