# Inserting multiple entrys into a db

**URL:** <https://forum.kirupa.com/t/inserting-multiple-entrys-into-a-db/245890>\
**Category:** Uncategorized\
**Created:** [December 5, 2007, 7:53am UTC](https://forum.kirupa.com/t/inserting-multiple-entrys-into-a-db/245890 "2007-12-05T07:53:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![koolkrasher](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@koolkrasher](https://forum.kirupa.com/u/koolkrasher)\
**Post date:** [December 5, 2007, 7:53am UTC](https://forum.kirupa.com/t/inserting-multiple-entrys-into-a-db/245890/1 "2007-12-05T07:53:42Z")

</div>

I finaly figured out how to add single entry to a db now i need to add multiple entrys to a db. here is the form im using and the post page.

figured u dont need to see the whole page

```auto

 <form method="post" action="input.php">
<input type="text" name="player_name" id="name" /> 
<select name="position" id="position">
            <option value="1" selected="selected">Manager</option>
            <option value="2">Pitcher</option>
            <option value="3">Catcher</option>
            <option value="4">1st Base</option>
            <option value="5">2nd Base</option>
            <option value="6">Short Stop</option>
            <option value="7">3rd Base</option>
            <option value="8">left Field</option>
            <option value="9">Center Field</option>
            <option value="10">Rite Field</option>
            <option value="11">DH</option>
              </select>
</form>

```

thats pretty much it but i want to repeat the same form 10x on a page and have all the info from the form put into a table.(i have it set up in my htm page 10x already shortened it to save some reading time)

and now for the input.php

```auto

<?php include_once("resources/includes/connection.php");?>
<?php
$sql="INSERT INTO players (player_name, position_id, $team_id)
VALUES
('$_POST[player_name]','$_POST[position_id]','$_POST[$team_id]')";

if (!mysql_query($sql))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close()
?>

```

i was thinking of sending the 10 input fields and position to an array but when i went to do it i was alos thinkin of repeating the $sql 10x but im not sure if that will over write the previous var’s sent.

any one have any ideas or suggestions?
