أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
can you please explain more
sure,why not! only let me know what kind of help do u need in detail...
Hello Amit,
If i did understand what you need then this article is very similar to what you looking for:
The idea is to catch form submit event by Jquery, send Ajax request in order to send the email to admin and to save the record, then you showing message you want to user.
In article i shared above it showing a thank you message, you simply replace it with form inputs that you can find them in submit event.
Best of Luck :)
Hi,
Send me ur details i will give u database structure.
if it is simple guest book you can save all data in XML and read it from XML easly to display in HTML .
create java script function for reading data and one for wirting data . it will be fast and you can upload it on any free hosting web site.
may you explain in detail what you need exactly.(web form or the database ..etc)
Hi
what kind of do you want??
Lets Read :
// XML BEGINE
<?xml version="1.0"?>
<guestbook>
<guest id="1001">
<firstname>John</firstname>
<lastname>Doe</lastname>
</guest>
<guest id="2002">
<firstname>Doe</firstname>
<lastname>John</lastname>
</guest>
</guestbook>
// XML END
// JAVA BEGINE
package com.comcom.com;
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class ReadXMLFile2 {
public static void main(String[] args) {
try {
File file = new File("guestbook.xml");
DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
Document doc = dBuilder.parse(file);
System.out.println("Root element :" + doc.getDocumentElement().getNodeName());
if (doc.hasChildNodes()) {
printNote(doc.getChildNodes());
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
private static void printNote(NodeList nodeList) {
for (int count =0; count < nodeList.getLength(); count++) {
Node tempNode = nodeList.item(count);
// make sure it's element node.
if (tempNode.getNodeType() == Node.ELEMENT_NODE) {
// get node name and value
System.out.println("\nNode Name =" + tempNode.getNodeName() + " [OPEN]");
System.out.println("Node Value =" + tempNode.getTextContent());
if (tempNode.hasAttributes()) {
// get attributes names and values
NamedNodeMap nodeMap = tempNode.getAttributes();
for (int i =0; i < nodeMap.getLength(); i++) {
Node node = nodeMap.item(i);
System.out.println("attr name : " + node.getNodeName());
System.out.println("attr value : " + node.getNodeValue());
}
}
if (tempNode.hasChildNodes()) {
// loop again if has child nodes
printNote(tempNode.getChildNodes());
}
System.out.println("Node Name =" + tempNode.getNodeName() + " [CLOSE]");
}
}
}
}
// JAVA END
Lets Write:
// XML BEGINE
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<guestbook>
<guest id="1">
<firstname>John</firstname>
<lastname>Doe</lastname>
</guest>
</guestbook>
// XML END
// JAVA BEGINE
package com.comcom.core;
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class WriteXMLFile {
public static void main(String argv[]) {
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
// root elements
Document doc = docBuilder.newDocument();
Element rootElement = doc.createElement("guestbook");
doc.appendChild(rootElement);
// guests elements
Element staff = doc.createElement("Guest");
rootElement.appendChild(guets);
// set attribute to staff element
Attr attr = doc.createAttribute("id");
attr.setValue("1");
staff.setAttributeNode(attr);
// shorten way
// staff.setAttribute("id", "1");
// firstname elements
Element firstname = doc.createElement("firstname");
firstname.appendChild(doc.createTextNode("John"));
staff.appendChild(firstname);
// lastname elements
Element lastname = doc.createElement("lastname");
lastname.appendChild(doc.createTextNode("Doe"));
staff.appendChild(lastname);
// write the content into xml file
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new File("C:\\file.xml"));
// FOR UNIX StreamResult(new File("/Users/<- your user name ->/Desktop/file.xml"));
// FOR LINNUX StreamResult(new File("/Home/<- your user name ->/Desktop/file.xml"));
// Output to console for testing
// StreamResult result = new StreamResult(System.out);
transformer.transform(source, result);
System.out.println("File saved!");
} catch (ParserConfigurationException pce) {
pce.printStackTrace();
} catch (TransformerException tfe) {
tfe.printStackTrace();
}
}
}
// JAVA END