0

hey guys i have question of displaying data with html in different page, it mean when i get data from web sql in the first page, then i click the data i want to edit and it link me to another page, so how can i do that? i test before with but it just redirect to that page and didn't show the selected data, so how am i suppose to do that, do anyone have the solution? big thanks.

The link below is my html page of display data in one page, hope you all can help me, big thanks. Here is my work (display data)

function showRecords(){
    results.innerHTML='';
    db.transaction(function(tx)
    {
        tx.executeSql(selectAll,[],function(tx,result)
        {
            dataset = result.rows;
            for(var i=0,item=null;i<dataset.length;i++)
            {
                item = dataset.item(i);
                results.innerHTML+=
                '<li>' + item['fname'] + ' <a href="#" onclick="loadRecord('+i+')">view</a>'+'<a href="#" onclick="deletetab('+item['id']+')">delete</a>'+'</li>';
            }
        });
    });
}

This is the code to show the records, but i want to show the selected records different page and edit, then update, mean that i click the view link then will redirect me to the other page and show all information of the select data, so what the best way? i got no idea since im new on this

function loadRecord(i){
    var item=dataset.item(i);
    fname.value = item['fname'];
    id.value = item['id'];
}

This my loadRecord, i think i need to edit this so that when i redirect to another html it can show the data, is it possible? please let me know, big thanks

newbie
  • 41
  • 11

1 Answers1

0

First of all your question is not clear.
If you meant that when edit button is clicked you want to go to another page where you can edit, then it can be done if you use any web development languages like php, jsp etc.

If you are using php or mysql, you will have 2 pages lets say home and edit.

Home Page

Here you will be showing the details. For that you will have to select it from database, and it will be like this:

$r=mysql_query("select * from table details);
$var=mysql_fetch_array($r);

Then put the edit link like this:

<a href="edit.php?var=$var['id']">

var['id'] will be value fetched from particular field of your table

Edit Page

In this page make the html part for editing, then in the php part write it like this

     mysql_query("select * from table where id=.'"$_GET['var']"'.");

Now the value from table will be selected according to the value of the id.

If you want it in more detail put your code and be more specific

freefaller
  • 19,368
  • 7
  • 57
  • 87
user1492669
  • 41
  • 1
  • 2
  • 10
  • hey man, i already put my code inside the jspiddle... http://jsfiddle.net/Gf9gp/ i just used html and javascript to develop, what i mean is i can get data from web sql and it can display from database too, and now the problem is to select a data that had stored and and how to let system redirect me to another page to edit and update the selected data – newbie Jul 04 '12 at 05:32
  • and im using pure html and javascript, i dont want to use php – newbie Jul 04 '12 at 07:16