Hi, I've got some code here, it it just php and html so you'll be able to see it working.
As you can see, I have 6 drop down list boxes. Each box contains numbers, whatever the user clicks I assign to a variable (there's one variable per box).
But, the stupid boxes don't stay on what number they're supposed to , ie clicked to, they go back to zero (well maybe I'm stupid. Well I don't care)
Also, when I set a number in one box, and click a different box, the original box gets reset to zero.
Here's the code.
<html>
<head>
</head>
<body>
<?php
if (!isset($_POST[Mode1])) {
$Mode1 = 1;
}else{
$Mode1 = $_POST[Mode1];
}
if (!isset($_POST[Mode2])) {
$Mode2 = 1;
}else{
$Mode2 = $_POST[Mode2];
}
if (!isset($_POST[Mode3])) {
$Mode3 = 1;
}else{
$Mode3 = $_POST[Mode3];
}
if (!isset($_POST[Mode4])) {
$Mode4 = 1;
}else{
$Mode4 = $_POST[Mode4];
}
if (!isset($_POST[Mode5])) {
$Mode5 = 1;
}else{
$Mode5 = $_POST[Mode5];
}
if (!isset($_POST[Mode6])) {
$Mode6 = 1;
}else{
$Mode6 = $_POST[Mode6];
}
print "<table>";
print "<tr><td>";
print "<H3>Item 1</H3>";
print "<form action='$_SERVER[PHP_SELF]' method='POST'>";
print "<SELECT NAME='Mode1' onChange='submit()'>";
print "<OPTION VALUE='0'>0";
print "<OPTION VALUE='1'>1";
print "<OPTION VALUE='2'>2";
print "<OPTION VALUE='3'>3";
print "<OPTION VALUE='4'>4";
print "</form>";
print "</td>";
print "<td>";
print "<H3>Item 2</H3>";
print "<form action='$_SERVER[PHP_SELF]' method='POST'>";
print "<SELECT NAME='Mode2' onChange='submit()'>";
print "<OPTION VALUE='0'>0";
print "<OPTION VALUE='1'>1";
print "<OPTION VALUE='2'>2";
print "<OPTION VALUE='3'>3";
print "<OPTION VALUE='4'>4";
print "</form>";
print "</td></tr>";
print "<tr><td>";
print "<H3>Item 3</H3>";
print "<form action='$_SERVER[PHP_SELF]' method='POST'>";
print "<SELECT NAME='Mode3' onChange='submit()'>";
print "<OPTION VALUE='0'>0";
print "<OPTION VALUE='1'>1";
print "<OPTION VALUE='2'>2";
print "<OPTION VALUE='3'>3";
print "<OPTION VALUE='4'>4";
print "</form>";
print "</td>";
print "<td>";
print "<H3>Item 4</H3>";
print "<form action='$_SERVER[PHP_SELF]' method='POST'>";
print "<SELECT NAME='Mode4' onChange='submit()'>";
print "<OPTION VALUE='0'>0";
print "<OPTION VALUE='1'>1";
print "<OPTION VALUE='2'>2";
print "<OPTION VALUE='3'>3";
print "<OPTION VALUE='4'>4";
print "</form>";
print "</td></tr>";
print "<tr><td>";
print "<H3>Item 5</H3>";
print "<form action='$_SERVER[PHP_SELF]' method='POST'>";
print "<SELECT NAME='Mode5' onChange='submit()'>";
print "<OPTION VALUE='0'>0";
print "<OPTION VALUE='1'>1";
print "<OPTION VALUE='2'>2";
print "<OPTION VALUE='3'>3";
print "<OPTION VALUE='4'>4";
print "</form>";
print "</td>";
print "<td>";
print "<H3>Item 6</H3>";
print "<form action='$_SERVER[PHP_SELF]' method='POST'>";
print "<SELECT NAME='Mode6' onChange='submit()'>";
print "<OPTION VALUE='0'>0";
print "<OPTION VALUE='1'>1";
print "<OPTION VALUE='2'>2";
print "<OPTION VALUE='3'>3";
print "<OPTION VALUE='4'>4";
print "</form>";
print "</td></tr>";
print $Mode1."<BR>";//Incidentally, why are these at the top of the page, not the bottom?
print $Mode2."<BR>";
print $Mode3."<BR>";
print $Mode4."<BR>";
print $Mode5."<BR>";
print $Mode6."<BR>";
?>
</A></A><body><html>
What I would dearly love, is for the boxes to stay on what they are clicked to, and for them not to reset all the other boxes back to zero.
PS - Each box has to submit() on their onChange, not click all six boxes then click some button which updates them all, zey must be independant...
Huge thanks and kudos in advance.
(Gregg)