Comparing 8 digital inputs to control multiplexer analog inputs

Thank you for all the information!

I've started to write some code by using this pages and your suggestions, I am sure the code looks really weird but maybe this is a start?

The codes is taken from this pages:

http://arduino.cc/en/Reference/If

My code:

int rx1 = 5;                 // input pin for RX1
int rx2 = 6;                 // input pin for RX2
int rx3 = 7;                 // input pin for RX3
int rx4 = 8;                 // input pin for RX4
int rx5 = 9;                 // input pin for RX5
int rx6 = 10;                // input pin for RX6
int rx7 = 11;                // input pin for RX7
int rx8 = 12;                // input pin for RX8
int tx = 13;                 // output pin for TX

unsigned long duration1;
unsigned long duration2;
unsigned long duration3;
unsigned long duration4;
unsigned long duration5;
unsigned long duration6;
unsigned long duration7;
unsigned long duration8;

// Variables will change:
int duration1Counter = 0;     // counter for the number of pulses
int duration2Counter = 0;     // counter for the number of pulses
int duration3Counter = 0;     // counter for the number of pulses
int duration4Counter = 0;     // counter for the number of pulses
int duration5Counter = 0;     // counter for the number of pulses
int duration6Counter = 0;     // counter for the number of pulses
int duration7Counter = 0;     // counter for the number of pulses
int duration8Counter = 0;     // counter for the number of pulses

int duration1State = 0;       // current state of the input
int duration2State = 0;       // current state of the input
int duration3State = 0;       // current state of the input
int duration4State = 0;       // current state of the input
int duration5State = 0;       // current state of the input
int duration6State = 0;       // current state of the input
int duration7State = 0;       // current state of the input
int duration8State = 0;       // current state of the input

int lastDuration1State = 0;   // previous state of the input
int lastDuration2State = 0;   // previous state of the input
int lastDuration3State = 0;   // previous state of the input
int lastDuration4State = 0;   // previous state of the input
int lastDuration5State = 0;   // previous state of the input
int lastDuration6State = 0;   // previous state of the input
int lastDuration7State = 0;   // previous state of the input
int lastDuration8State = 0;   // previous state of the input

void setup()
{
  pinMode(rx1, INPUT);     // initialize the digital pin as a input
  pinMode(rx2, INPUT);     // initialize the digital pin as a input
  pinMode(rx3, INPUT);     // initialize the digital pin as a input
  pinMode(rx4, INPUT);     // initialize the digital pin as a input
  pinMode(rx5, INPUT);     // initialize the digital pin as a input
  pinMode(rx6, INPUT);     // initialize the digital pin as a input
  pinMode(rx7, INPUT);     // initialize the digital pin as a input
  pinMode(rx8, INPUT);     // initialize the digital pin as a input
}

void loop()
{
  duration1 = pulseIn(rx1, HIGH);
  duration2 = pulseIn(rx2, HIGH);
  duration3 = pulseIn(rx3, HIGH);
  duration4 = pulseIn(rx4, HIGH);
  duration5 = pulseIn(rx5, HIGH);
  duration6 = pulseIn(rx6, HIGH);
  duration7 = pulseIn(rx7, HIGH);
  duration8 = pulseIn(rx8, HIGH);
  
  // if input is detected, turn on output
 if (rxState >= 1)
 {
   digitalWrite(tx, HIGH);
 }
 else
 {
   digitalWrite(tx, LOW);
 }
}

Am I on the right track?

Best regards,
Swoshie