Code wont function correctly (GSM Module)

sjpiercy86:
I've copied the code in, I've selected an appropriate title, I've put it in correct forum as I believe this to be a programming issue. I've googled and googled and googled with very little joy.

So you read the first 5 sections. You should have read the seventh section.

At least we can see some code, now. Now, the question is exactly how your switch is wired. Specifically, what size resistor are you using, and how is it connected?

If you don't have a resistor, you have a floating pin, and can not trust reading the pin to cause the desired behavior.

if (buttonState == HIGH) {
    digitalWrite(ledPin, HIGH);
    } else {
      // if the current state is LOW then the button went from on to off:
     digitalWrite(ledPin, LOW);
    }
    // Delay a little bit to avoid bouncing
    delay(50);

    if (buttonState == HIGH) {

In between the if statements, nothing causes buttonState to change. If the first one evaluates to true, how likely is it that the second one won't also evaluate to true? If the likelihood is certain (it is), is there any reason to perform the test?