Debug in Javascript
<html>
<head>
<script type="text/javascript">
var variablename = 7;
function show_alert()
{
alert(variablename);
}
</script>
</head>
<body>
<input type="button" οnclick="show_alert()" value="Show alert box" />
</body>
</html>
DIY javascript stack trace
JavaScript Trace Window
Javascript Basic
Manipulate Form Elements with Javascript
How to create HIDDEN Input element using DOM
Thread: creating hidden field in javascript
...How to create hidden variables dynamically?
insert hidden input element to form
How can I add a hidden form field just before submitting a form using JavaScript?
Pass values to PHP
Array values from javascript to php
My Case Study: Passing Ordered Teams To Server
Step 1: Add a hidden input field to the form
Step 2: Add one Javascript function that populates all the teams id, and concatenate them, put it into this hidden input value
Step 3: Call this Javascript function before submit
Step 4: Receive the hidden input at server end with PHP
Do a testing at this point:
please note the order before clicking 'save':
and what does PHP receive?
the order is saved!!
Step 5: Explode the string into array of ids
The array becomes an array of integers now!!
REFS:
http://www.hscripts.com/tutorials/php/jsArrayToPHP.php
http://hk.php.net/manual/en/function.array-shift.php
http://php.net/manual/en/function.explode.php