tries to assign the value identified as $name1 to the (read only) line read from standard input. Swap the lvalue (left side of the assignment operator) with the rvalue (right side) and you'll have better luck:
Of course, if you have a variable number of things to read, you're better off with an array. See
.