• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

no data in base

 
wanee wwwwww
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.sql.*"%>
<html>
<body>
<%
Statement stmt=null;
Connection con=null;
if(request.getParameter("bt_sign_up")!=null){
String URL="jdbc:mysql://localhost/translation_db";
String username="root";
String pass="";
String email=request.getParameter("txt_email");
String password=request.getParameter("txt_spassword");
String firstname=request.getParameter("txt_firstname");
String lastname=request.getParameter("txt_lastname");
String gender=request.getParameter("rb_gender");
String date_of_birth=request.getParameter("txt_dob");
String country_id=request.getParameter("dd_country");
String nationality_id=request.getParameter("dd_nationality");
String phone=request.getParameter("txt_phone");
String education=request.getParameter("txt_education");
String picture_path=request.getParameter("file_upload");
String role_id=request.getParameter("role_id");
String last_login=request.getParameter("last_login");
String member_level=request.getParameter("member_level");
String receiving=request.getParameter("receiving");


try{
Class.forName("org.gjt.mm.mysql.Driver");
}catch(ClassNotFoundException e1){
out.println("à¡Ô´¢éͼԴ¾ÅÒ´"+e1);
}
try{
con=DriverManager.getConnection(URL,username,pass);
stmt=con.createStatement();
String sql="INSERT INTO members VALUES('','"+firstname+"','"+lastname+"','"+email+"','"+password+"','"+gender+"','"+
date_of_birth+"','"+country_id+"','"+nationality_id+"','"+phone+"','"+education+"','"+picture_path+"','"+role_id+"','
"+last_login+"','"+member_level+"','"+receiving+"')";
int row=stmt.executeUpdate(sql);
if(row!=0){
out.println("à¾ÔèÁ¢éÍÁÙÅÊÓàÃç¨");
out.println("<br><a href='show_person.jsp'>áÊ´§¢éÍÁÙÅ</a>");
}else{
out.println("äÁèÊÒÁÒöà¾ÔèÁ¢éÍÁÙÅä´é");}
}catch(SQLException e2){
out.println("à¡Ô´¢éͼԴ¾ÅÒ´"+e2);
}
stmt.close();
con.close();
}else{
%>
<script language="JavaScript">
<!--
function radio_button_checker()
{
// set var radio_choice to false
var radio_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < text_form.rb_gender.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (text_form.rb_gender[counter].checked)
radio_choice = true;
}

if (!radio_choice)
{
// If there were no selections made display an alert box
alert("Please select a letter.")
return (false);
}
return (true);
}

-->
</script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="stylesheet4.css" rel="stylesheet" type="text/css" />
</head>

<body class="thrColElsHdr">
<script Language="JavaScript">
<!--
function Blank_TextField_Validator()
{

if (text_form.txt_email.value == "")
{
alert("Please fill in your email.");
text_form.txt_email.focus();
return (false);
}

if (text_form.txt_spassword.value == "")
{
alert("Please fill in your password.");
text_form.txt_spassword.focus();
return (false);
}

if (text_form.txt_cpassword.value == "")
{
alert("Please fill in your Confirm password.");
text_form.txt_cpassword.focus();
return (false);
}

if (text_form.txt_firstname.value == "")
{
alert("Please fill in your firstname.");
text_form.txt_firstname.focus();
return (false);
}

if (text_form.txt_lastname.value == "")
{
alert("Please fill in your lastname.");
text_form.txt_lastname.focus();
return (false);
}

if (text_form.txt_phone.value == "")
{
alert("Please fill in your phone number.");
text_form.txt_phone.focus();
return (false);
}

if (text_form.txt_education.value == "")
{
alert("Please fill in your education.");
text_form.txt_education.focus();
return (false);
}


return (true);
}

</script>


<form action="proj2.jsp" method="post" onsubmit="return Blank_TextField_Validator()"&"return radio_button_checker()" enctype="multipart/form-data" name="text_form" id="form1">

<div id="master_header">
TRANSCIPTION & TRANSLATION SERVICE SYSTEM
<div id="top_menu"><a href="index.html">Home</a><a href="sign_up.html">Sign Up</a><a href="news.html">News</a><a href="article.html">Article</a><a href="jobs.html">Jobs</a><a href="#">About Us</a><a href="#">Contact</a></div>
</div>
<div id="container">
<div id="sub_header">
<h2>Introduction...</h2>
"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains."
</div>
<div id="sidebar2">
The background color on this div will only show for the length of the content. If you'd like a dividing line instead, place a border on the right side of the #mainContent div if the #mainContent div will always contain more content than the #sidebar2 div.
Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut, sapien.
</div>
<div id="mainContent_expand">
<div id="topContent">
<div id="topContent_top">
Sign Up to be our new "Translator"...
</div>
<div id="topContent_body">
<table width="80%">
<tr>
<td width="200">Email</td>
<td><input type="text" name="txt_email" id="txt_email" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="text" name="txt_spassword" id="txt_spassword" /></td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input type="text" name="txt_cpassword" id="txt_cpassword" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Firstname</td>
<td><input type="text" name="txt_firstname" id="txt_firstname" /></td>
</tr>
<tr>
<td>Lastname</td>
<td><input type="text" name="txt_lastname" id="txt_lastname" /></td>
</tr>
<tr>
<td>Gender</td>
<td><input name="rb_gender" type="radio" id="rb_gender" value="Male" checked="checked" />
Male
<input name="rb_gender" type="radio" id="rb_gender2" value="Female" />
Female</td>
</tr>
<tr>
<td>Date of birth</td>
<td><input type="text" name="txt_dob" id="txt_dob" /></td>
</tr>
<tr>
<td>Country</td>
<td><select name="dd_country" id="dd_country">
<option value="1">thai</option>
<option value="2">loas</option>
</select></td>
</tr>
<tr>
<td>Nationality</td>
<td><select name="dd_nationality" id="dd_nationality">
<option value="1">thai</option>
<option value="2">jin</option>
</select></td>
</tr>
<tr>
<td>Phone</td>
<td><input type="text" name="txt_phone" id="txt_phone" /></td>
</tr>
<tr>
<td>Education</td>
<td><textarea name="txt_education" id="txt_education" cols="45" rows="5"></textarea></td>
</tr>
<tr>
<td>Your Photo</td>
<td><input type="file" name="file_upload" id="file_upload" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Your Translate Languages</td>
<td><input type="text" name="txt_languages" id="txt_languages" />
<input type="button" name="bt_add" id="bt_add" value="Add" /></td>
</tr>
<tr>
<td>Want to receive email about a job that match your language?</td>
<td><input name="chk_receive" type="checkbox" id="chk_receive" checked="checked" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="bt_sign_up" id="bt_sign_up" value="Sign Up" /></td>
</tr>
</table>
</div>
</div>
<br/>
<div id="subContent">

</div>
</div>
<br class="clearfloat" />
<div id="footer">
<p>Footer</p>
</div>
</div>
</form>
</body>
</html>
<%}%>



 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"waneee wwwwww", please check your private messages for an important administrative matter.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then, please read through this carefully.

Just posting a bunch of code with no explanation is not a useful exercise. Please accurately and completely describe your issue and what you would like help with.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic