Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8154915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:30:40+00:00 2026-06-06T16:30:40+00:00

I am new to mobile application development with PhoneGap. I have created a form

  • 0

I am new to mobile application development with PhoneGap. I have created a form to add and show name, address and phone number of a student in SQLite database. But the problem is I don’t know to retrieve and display the values in the text boxes.

<!DOCTYPE HTML>
<html>
 <head>
    <title>Contact Example</title>

    <script type="text/javascript" charset="utf-8" src="phonegap-1.4.1.js"></script>
    <script type="text/javascript" charset="utf-8">

    document.addEventListener("deviceready", onDeviceReady, false);

    function onDeviceReady() {
        var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
        db.transaction(populateDB, errorCB, successCB);
    }


    function populateDB(tx) {
         tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (sname ,saddress ,sphone)');
    }


    function errorCB(tx, err) {
        alert("Error processing SQL: "+err);
    }

    // Transaction success callback
    //
    function successCB() {
        alert("success!");
    }

    function add(tx){
        var name=document.getElementById('n');
        var address=document.getElementById('a');
        var phone=document.getElementById('p');
        tx.executeSql('INSERT INTO DEMO (sname ,saddress ,sphone) VALUES ('"+name+"','"+address+"','"+phone+"')');
        //tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")');    

    }

    function show(tx){
        var name=document.getElementById('n');
        tx.executeSql('SELECT * FROM DEMO WHERE (sname='"+name+"')');   
         document.f.n.value=name;
         document.f.a.value=//??;
         document.f.p.value=//??;
    }

    </script>
  </head>
  <body>
    <form name="f" method="get" action="">
      Name  :<input type="text" id="n" size="10"></input><br>
      Add &nbsp;&nbsp;&nbsp; :<input type="text" id="a" size="10"></input><br>
      Phone :<input type="text" id="p" size="10"></input><br>
      <input type="button" value="Add" onClick="add()">
      <input type="button" value="Show" onClick="show()">
    </form>
  </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:30:43+00:00Added an answer on June 6, 2026 at 4:30 pm
    document.addEventListener("deviceready", onDeviceReady, false);
    
        function onDeviceReady() 
        {
          alert("onDeviceReady called");
        }
    
    
        function populateDB(tx)
        {
             tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (sname ,saddress ,sphone)');
                var name=document.getElementById('n');
            var address=document.getElementById('a');
            var phone=document.getElementById('p');
            tx.executeSql('INSERT INTO DEMO (sname ,saddress ,sphone) VALUES ('"+name.value+"','"+address.value+"','"+phone.value+"')');
        }
    
    
        function errorCB(tx, err) 
        {
            alert("Error processing SQL: "+err);
        }
    
        // Transaction success callback
        //
        function successCB() 
        {
            alert("success!");
        }
    
        function add()
        {
          var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
            db.transaction(populateDB, errorCB, successCB);
         }
    

    for more see link here

    //show data from db
    
    // Transaction success callback
        function show()
         {
            var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
            db.transaction(queryDB, errorCB);
        }
    // Query the database
    
        function queryDB(tx) 
        {
            tx.executeSql('SELECT * FROM DEMO', [], querySuccess, errorCB);
        }
    
        // Query the success callback
    
        function querySuccess(tx, results)
         {
          var len = results.rows.length;
            console.log("DEMO table: " + len + " rows found.");
            for (var i=0; i<len; i++){
                console.log("Row = " + i + " sname = " + results.rows.item(i).sname + " saddress =  " + results.rows.item(i).saddress);
            }
    
        }
    
        // Transaction error callback
    
        function errorCB(err)
         {
            console.log("Error processing SQL: "+err.code);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to mobile application development, and I am integrating Google Maps in
I'm new mobile development and i'm working on an proof of concept application on
Hi there Im new to mobile application development. I had developed Android apps using
i am new in blackberry development. and i have task to develop the application
I am new to Android mobile application development. I would like to know, how
I am new on mobile development, so I decided to use Phonegap to develop
I have a quick question regarding to mobile development, I'm new at this, so
I've developed a web application for mobile. As I'm new to mobile web development
We'll soon be embarking on the development of a new mobile application. This particular
I am new to J2ME application development. Normally I have developed j2me apps for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.