I have a problem. I have created a php website and with every item there is a "request a quote" button. on clicking the button, i want the item name to be added to an array (which i am doing through Javascript).subsequently, the array is to be added to the request form "message" field on contact.php. i have used this -
<script language="javascript">
// Empty array
var empty = [];
// Array containing initial elements.
var arrayitem= ['hello'];
alert(arrayitem[1]);
function myFunction(item) {
arrayitem.push(item);
var Items='';
for (var i = 0; i < arrayitem.length; i++) {
Items=Items+','+(arrayitem[i]);
alert(Items);
};
document.getElementById("message").value=arrayitem[1];
}
</script>
on header.php page, which i include on every page. I have two more pages- 1. computers.php- that contains computers as items and 2. softwares.png- that contains softwares as items.
Now the problem is, when i add items from one page, they are appended to the array and it works fine, but when i navigate to another page, the items added from previous page get removed from the array ..and moreover i cant see the araay items in the "message field of contactus.php.".please help