<%-- Document : JoinOurMailing Created on : May 6, 2010, 4:16:27 AM Author :Tsehay Abera Email : hellen_abera@yahoo.com --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> GreenLand Development Foundation
<%@include file="/ssi/Gheader.jsp"%> <%@include file="/ssi/Gleft.jsp"%>
<%@page language="java" import="java.sql.*" errorPage="" %> <%@page import="java.util.*, java.io.*,java.sql.*,javax.sql.*" %>

 

Join Our Mailing List

<%! public static Integer changsub = 0; %> <% if (request.getParameter("subfor") == "") { changsub = 0; } if (request.getParameter("subfor") != "" && changsub == 0) { String Name = request.getParameter("name"); String Address = request.getParameter("address"); String Mobile = request.getParameter("mobile"); String Phone = request.getParameter("phone"); String Email = request.getParameter("email"); String Comments = request.getParameter("comments"); // String connectionURL ="jdbc:mysql://localhost/greenldf"; //Connection conn = null; // executeQuery() method execute specified sql query. PreparedStatement pstatement = null; // Load JBBC driver "com.mysql.jdbc.Driver" // Class.forName("com.mysql.jdbc.Driver").newInstance(); int que = 0; // check if the text box is empty if ((Name != null && Email != null && Comments != null) && (Name != "" && Email != "" && Comments != "") && ((Address != "" || Address == "" || Mobile != "" || Mobile == "" || Phone != "" || Phone == "") && ((Address != null || Address == null || Mobile != null || Mobile == null || Phone != null || Phone == null)))) { // if ((Name != null && Email != null && Comments !=null ) && (Address != null || Mobile != null || Phone != null)) { /*if (Name != null && Email != null && Comments != null){ Name = request.getParameter("name").toString().replace("<",">"); Name.replace(">",">"); Address = request.getParameter("address").replace("<",">"); Address.replace(">",">"); Mobile = request.getParameter("mobile").replace("<",">"); Mobile.replace(">",">"); Phone = request.getParameter("phone").replace("<",">"); Phone.replace(">",">"); Email = request.getParameter("email").replace("<",">"); Email .replace(">",">"); Comments = request.getParameter("comments").replace("<",">"); Comments .replace(">",">");*/ try { // conn = DriverManager.getConnection(connectionURL, "root", ""); String queryString = "INSERT INTO joinourmailing(Name,Adress,Mobile,Phone,Email,Comments) VALUES (?,?,?,?,?,?)"; pstatement = connection.prepareStatement(queryString); pstatement.setString(1, Name); pstatement.setString(2, Address); pstatement.setString(3, Mobile); pstatement.setString(4, Phone); pstatement.setString(5, Email); pstatement.setString(6, Comments); que = pstatement.executeUpdate(); %> <% if (que != 0) { changsub = 1; %>

You are Registered successfuly

<% } } catch (Exception ex) { out.println("Unable to connect to database."); } finally { // close all the connections. pstatement.close(); connection.close(); } request.setAttribute("one", ""); request.setAttribute("two", ""); request.setAttribute("three", ""); } else { if (Name == "" && Email != "" && Comments != "") { out.println("

You must fill Name

"); request.setAttribute("one", "red"); } else if (Name == "" && Email == "" && Comments != "") { out.println("

You must fill Name and Email

"); request.setAttribute("one", "red"); request.setAttribute("two", "red"); } else if (Name == "" && Email != "" && Comments == "") { out.println("

You must fill Name and Comment

"); request.setAttribute("one", "red"); request.setAttribute("three", "red"); } else if (Name != "" && Email == "" && Comments != "") { out.println("Email Empty"); request.setAttribute("two", "red"); }else if (Name != "" && Email == "" && Comments == "") { out.println("

You must fill Email and Comment

"); request.setAttribute("two", "red"); request.setAttribute("three", "red"); } else if (Name != "" && Email != "" && Comments == "") { out.println("Comment empity"); request.setAttribute("three", "red"); } else if (Name == "" && Email == "" && Comments == "") { out.println("

You must fill at least Name, Email and Comment

"); request.setAttribute("one", "red"); request.setAttribute("two", "red"); request.setAttribute("three", "red"); } } } %>
Name : " type="text" name="name" value="<% if (request.getParameter("name") != null) { out.println(request.getParameter("name")); }%>" size="20" />
Address :
Mobile : " type="text" name="mobile" size="20"/>
Phone : " style="background-color:#ffffff" type="text" name="phone" size="20"/>
Email : " style="background-color:#ffffff;border-color:<%=request.getAttribute("two")%>" type="text" name="email" size="20"/>
Comments :

Please Click New To Register


Donation to Green Land Development Foundation



<%@include file="/ssi/Gfooter.jsp"%>