I’ve moved my bit register to an array and come up with this
[php]<?php
$bit = array();
for ($i = 0; $i <= 9; $i++) {
$bit[$i]=0;
}
$bit[‘0’]=1;
$bit[‘1’]=1;
$bit[‘2’]=0;
$bit[‘3’]=1;
$bit[‘4’]=0;
$bit[‘5’]=1;
$bit[‘6’]=1;
$bit[‘7’]=0;
$bit[‘8’]=1;
$bit[‘9’]=1;
function GPIO0() {
print(“THIS IS FUNCTION GPIO0 AND WILL EXECUTE SOME COOL SERVERSIDE CODE EVENTUALLY”);
}
function GPIO1() {
print(“THIS IS FUNCTION GPIO1”);
}
function GPIO2() {
print(“THIS IS FUNCTION GPIO2”);
}
function GPIO3() {
print(“THIS IS FUNCTION GPIO3”);
}
function GPIO4() {
print(“THIS IS FUNCTION GPIO4”);
}
function GPIO5() {
print(“THIS IS FUNCTION GPIO5”);
}
function GPIO6() {
print(“THIS IS FUNCTION GPIO6”);
}
function GPIO7() {
print(“THIS IS FUNCTION GPIO7”);
}
function GPIO8() {
print(“THIS IS FUNCTION GPIO8”);
}
function GPIO9() {
print(“THIS IS FUNCTION GPIO9”);
}
function postFunction() {
$postF = ($_POST[“GPIO”]);
return $postF();
}
if (isset($_POST[“GPIO”])){
postFunction();
}
function printButton($GPIO){
if ($bit[$GPIO]==1){
print("
\n");
}else{
print("
\n");
}
}
print("<html><body>\n");
print("<form action=index.php method=POST>\n");
printButton(0);
printButton(1);
printButton(2);
printButton(3);
printButton(4);
printButton(5);
printButton(6);
printButton(7);
printButton(8);
printButton(9);
print("</form>\n");
print("</body></html>\n");
?>[/php]
but this part doesn’t work
[php]
function printButton($GPIO){
if ($bit[$GPIO]==1){
print("
\n");
}else{
print("
\n");
}
[/php]
yet if I move it out of the function it works fine
[php]
$GPIO=1;
if ($bit[$GPIO]==1){
print("
\n");
}else{
print("
\n");
}
I feel so close to getting it to do what I want…
[/php]