Below I have a function which saves variable on a PHP form to a list of objects in javascript
a.js
function save()
{
var oldItems = JSON.parse(localStorage.getItem('itemsArray')) || [];
var newItem =
{
'num' : document.getElementById("num").value,
'methv' : document.getElementById("methv").value,
'q1' : document.getElementById("q1").value,
'q2' : document.getElementById("q2").value,
'q3' : document.getElementById("q3").value,
'q4' : document.getElementById("q4").value,
'comm' : document.getElementById("comm").value
};
oldItems.push(newItem);
localStorage.setItem('itemsArray', JSON.stringify(oldItems));
}
How can i display the contents in my php page so i can edit them? (examples of what it will look like printed out is appreciated)
Edit*
These are the values that will be added to the object
<form action="" method="post" enctype="multipart/form-data">
<select name="methv" class="textfields" id="methv" style="width:110px" >
<option value= "dont know">dont know </option>
<select name="q1" class="textfields" id="q1" style="width:50px" >
<option value= "-">-</option>
<option value= "L">L</option>
<select name="q2" class="textfields" id="q2" style="width:50px" >
<option value= "-">-</option>
<option value= "L">L</option>
<select name="q3" class="textfields" id="q3" style="width:50px" >
<option value= "-">-</option>
<option value= "L">L</option>
<select name="q4" class="textfields" id="q4" style="width:50px" >
<option value= "-">-</option>
<option value= "L">L</option>
<textarea rows="4" cols="40" id="comm" name="comm" style="width:300px"><?php echo $post['addcomment'] ;?></textarea>
</form>
I have only imported a.js and <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>