function getBooksTable() { $bookModel = new BookModel(); $books = $bookModel->getBooks(); $result = "<div style='height:400px;overflow:auto;'>\n\t\t\t\t\t<table class='tables'>\n\t\t\t\t\t <thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t <th>Id</th>\n\t\t\t\t\t\t <th>Title</th>\n\t\t\t\t\t\t <th>Author</th>\n\t\t\t\t\t\t <th>Description</th>\n\t\t\t\t\t\t <th>Publisher</th>\n\t\t\t\t\t\t <th>Category</th>\n\t\t\t\t\t\t <th>Cover</th>\n\t\t\t\t\t\t <th>Publish year</th>\n\t\t\t\t\t\t <th>Grade</th>\n\t\t\t\t\t\t <th>Price</th>\n\t\t\t\t\t\t <th>Location</th>\n\t\t\t\t\t\t <th>Action</th>\n\t\t\t\t\t\t <!--<th>Delete</th>-->\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t </thead>\n\t\t\t\t\t <tbody>"; foreach ($books as $book) { $result = $result . "<form action='' method='post'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t <td width='10px' ><input type='hidden' name='idBook_save' value='{$book->idBook}' />{$book->idBook}</td>\n\t\t\t\t\t\t <!--<td contenteditable><input type='p' name='title_save' value='{$book->title}' /></td>-->\n\t\t\t\t\t\t <td contenteditable>{$book->title}</td>\n\t\t\t\t\t\t <td contenteditable>{$book->author}</td>\n\t\t\t\t\t\t <td contenteditable><div style='height:50px;overflow:auto;'>{$book->description}</div></td>\n\t\t\t\t\t\t <td contenteditable>{$book->publisher}</td>\n\t\t\t\t\t\t <td contenteditable>{$book->category}</td>\n\t\t\t\t\t\t <td contenteditable><img src = '{$book->cover}' width = 50px height=50px></td>\n\t\t\t\t\t\t <td contenteditable>{$book->rYear}</td>\n\t\t\t\t\t\t <td contenteditable>{$book->grades}/{$book->noGrades}</td>\n\t\t\t\t\t\t <td contenteditable>{$book->price}</td>\n\t\t\t\t\t\t <td contenteditable>{$book->location}</td>\n\t\t\t\t\t\t <!--<td>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<input type='hidden' name='author_save' value='{$book->author}' />\n\t\t\t\t\t\t\t\t<input type='hidden' name='description_save' value='{$book->description}' />\n\t\t\t\t\t\t\t\t<input type='hidden' name='publisher_save' value='{$book->publisher}' />\n\t\t\t\t\t\t\t\t<input type='hidden' name='category_save' value='{$book->category}' />\n\t\t\t\t\t\t\t\t<input type='hidden' name='cover_save' value='{$book->cover}' />\n\t\t\t\t\t\t\t\t<input type='hidden' name='rYear_save' value='{$book->rYear}' />\n\t\t\t\t\t\t\t\t<input type='hidden' name='grades_save' value='{$book->grades}' />\n\t\t\t\t\t\t\t\t<input type='hidden' name='noGrades_save' value='{$book->noGrades}' />\n\t\t\t\t\t\t\t\t<input type='hidden' name='price_save' value='{$book->price}' />\n\t\t\t\t\t\t\t\t<input type='hidden' name='location_save' value='{$book->location}' />\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<input type='submit' name='save_book' value='' id='save_book'>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t </td>-->\n\t\t\t\t\t\t <td>\n\t\t\t\t\t\t\t<form action='' method='post'>\n\t\t\t\t\t\t\t\t<input type='hidden' name='book_to_del' value='{$book->idBook}' />\n\t\t\t\t\t\t\t\t<input type='submit' name='delete_book' value='' id='del_book'/>\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t </td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</form>"; } $result = $result . "<form action='' method='post'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t <td/></td>\n\t\t\t\t\t\t <td contenteditable><input type='p' name='new_title' value=' ' /></td>\n\t\t\t\t\t\t <td contenteditable><input type='p' name='new_author' value=' ' /></td>\n\t\t\t\t\t\t <td contenteditable><input type='p' name='new_description' value=' ' /></td>\n\t\t\t\t\t\t <td contenteditable><input type='p' name='new_publisher' value=' ' /></td>\n\t\t\t\t\t\t <td contenteditable><input type='p' name='new_category' value=' ' /></td>\n\t\t\t\t\t\t <td contenteditable><input type='file' name='new_cover' value=' '/></td>\n\t\t\t\t\t\t <td contenteditable><input type='p' name='new_rYear' value=' ' /></td>\n\t\t\t\t\t\t <td contenteditable><input type='p' value='0/0' /></td>\n\t\t\t\t\t\t <td contenteditable><input type='p' name='new_price' value=' ' /></td>\n\t\t\t\t\t\t <td contenteditable><input type='p' name='new_location' value=' ' /></td>\n\t\t\t\t\t\t <td><input type='submit' name='insert_book' value=' ' id='insert_book'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</form>"; $result = $result . "</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t\t</div>"; return $result; }