I've created a local website to inventory and catalog my comics and I'm wondering how I can possibly expedite the addition of certain records.
For instance, I might want to add 10 sequential issues of a series without having to type mostly redundant data in my form over and over again. I'm wondering if when I'm adding a record I could add a checkbox for multiple issues and maybe have an input for a number with a starting issue parameter or something like that?
I have a form and my insert method:
<form action="addBooks.php" method="post">
<div class="row">
<div class="col-xs-3">
<label>Title:</label>
<input type="text" class="form-control" name="title" required>
</div>
<div class="col-xs-3">
<label>Main Character:</label>
<input type="text" class="form-control" name="mainCharacter" required>
</div>
<div class="col-xs-3">
<label>Author:</label>
<input type="text" class="form-control" name="author" required>
</div>
<div class="col-xs-3">
<label>Illustrator:</label>
<input type="text" class="form-control" name="illustrator" required>
</div>
</div>
<br>
<div class="row">
<div class="col-xs-3">
<label>Issue:</label>
<input type="text" class="form-control" name="issue" required>
</div>
<div class="col-xs-3">
<label>Cover:</label>
<input type="text" class="form-control" name="cover" required>
</div>
<div class="col-xs-3">
<label>Year Published:</label>
<input type="text" class="form-control" name="yearPub" required>
</div>
<div class="col-xs-3">
<label>Comments:</label>
<textarea class="form-control" name="comments"></textarea>
</div>
</div>
<button type="submit" class="btn btn-default">Submit</button>
INSERT INTO comics.comic_inventory
(Title,Author,Illustrator,Main_character,issue,cover,publish_date,comments,date_added)
VALUES ('$_POST[title]',
'$_POST[author]',
'$_POST[illustrator]',
'$_POST[mainCharacter]',
'$_POST[issue]',
'$_POST[cover]',
'$_POST[yearPub]',
'$_POST[comments]',
current_timestamp()
)";
if ($conn->query($sql) === TRUE) {
header("Location: index.php");
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
So I would want to have it enter 10 records with the same data except for the issue number. Maybe I could have an input for starting issue, so if I put '1' as the starting issue it would insert 10 records with issue going from 1 through 10. Does that make sense?