Arduino uno PINB misreading

So I've got several buttons connected up to pins 8-13 in my circuit (like this: http://www.arduino.cc/en/uploads/Tutorial/button.png), and am reading them through PINB. However, I get random results that aren't affected by whether there is power going to the buttons or not.
Here is my code:

void setup()
{
DDRB = B00000000;
Serial.begin(9600);
}

void loop()
{
delay(1000);
Serial.print(PINB);
Serial.print("_");
}

Does anyone know what I'm doing wrong? (I'm using an uno if that helps)

When you press the button which pins on it are shorted together ?

Use google to look up "Floating Input"

When I press the button, 3v3 is shorted to, Pin 8,9,10,11,12 or 13 of the arduino and GND through a resistor

So I wrote this code to read PINB (pins 8-13),

void setup()
{
DDRB = B00000000;
Serial.begin(9600);
}

void loop()
{
delay(1000);
Serial.print(PINB);
Serial.print("_");
}

Even if I have no input to any of those pins, the integer printed out isn't zero and changes from time to time. Is this due to noise (I thought that only happened when attached the board)?

The pins as input are very high impedance (I mean very very high). They will pick up any noise, static, nearby voltages, and more.

Woah! That's a huge relief, I thought my board was broken. Thank you!

I find even when I have a button circuit set up like this:

It changes too, even though there's a resistor. Do you know how I can fix this?

Just to add, could a decoupling capacitor fix the problem with buttons and noise?

Do not cross-post. Threads merged.

It should not change during reset. You could measure if the 10k resistor is always between the input pin and GND. Perhaps you have the button 90 degrees rotated.

Avoid pin 13.
Depending on the type of Arduino, an onboard LED/resistor could be permanently attached to that pin.
When the pin is used as input, e.g with a switch to ground, it could permanently be ~1.8volt. Never getting "high", even with a 10k pull-up resistor.
Leo..

Yes, the older Duemilanove, and the Promini and Nano have an LED/Resistor to Gnd.
I think most others use an op amp as a buffer to drive the onboard LED.
Even if the LED is driven directly, it only presents a small load, a mA or so, that an external device can usually drive okay.
A button to Gnd would certainly not be a problem.
DDRB only sets the input/output direction.
I would enable the internal pullup resistor, then use a switch to Gnd to take the desired pin low.
In setup() :
for (byte x = 8; x<14; x=x+1){
pinMode (x, INPUT_PULLUP); // sets DDRB and PUD as needed
}
Then loop the same as you had before:
void loop()
{
delay(1000);
Serial.print(PINB); // x-x-D13-D12-D11-D10-D9-D8, upper 2 bits not connected to IO pins
Serial.print("_");
}