This is pretty clearly homework, so I'm not going to give you the full answer.
But let me recommend a couple of things:
(1) Use meaningful function names.
insert1 and
insert2 are meaningless.
(2) When operation on parallel arrays, operate on both at the same time.
So, in place of
Code:
//set functions for the book name entry
function insert1(value)
{
bookname[bookname.length]=value;
}
//set function for the book price entry
function insert2(value)
{
bookprice[bookprice.length]=value;
}
Better is:
Code:
function addNameAndPrice( name, price )
{
bookname[bookname.length] = name;
bookprice[bookprice.length] = price;
}
There are much better ways to do this than parallel arrays, but that's going to be beyond the level you are at now. But you can clearly do as shown, to be sure (for example) that you don't end up with 17 books and only 9 prices. Or vice versa.
**********
Now, to answer your real question:
You have *TWO* forms there!!! The "this.form" in your button is referring to the second <form>, but the
name field is in the first <form>, so it can't be found.
You should ALMOST NEVER have two <form>s on a page. Get rid of the first </form> and the second <form>.