Associate
- Joined
- 8 Jan 2013
- Posts
- 220
Hi im basically making a simple site/database to manage our backups at work.
I need to be able to add a months worth of backups (20 or so tapes) into the same 'submit' so they all add at the same time.
I have 3 forms
Month, tape and location.
The month and location will stay the same for the months backups but the tape number will change.
How do i easily have the option to add multiple numbers into a form but keep the month/location the same (I hope im explaining it correct)
This is my first attempt at something like this
My Forms
Insert.php
Any helpful pointers would be great!
I need to be able to add a months worth of backups (20 or so tapes) into the same 'submit' so they all add at the same time.
I have 3 forms
Month, tape and location.
The month and location will stay the same for the months backups but the tape number will change.
How do i easily have the option to add multiple numbers into a form but keep the month/location the same (I hope im explaining it correct)
This is my first attempt at something like this
My Forms
Code:
<form action="insert.php" method="post">
<p style="text-align: center;">Month: <input type="text" name="Month" /></p>
<p style="text-align: center;">Tape: <input type="text" name="Tape" /></p>
<p style="text-align: center;">Location: <input type="text" name="Location" /></p>
<p style="text-align: center;"><input type="submit" value="Submit Query" /></p>
</form>
Insert.php
Code:
<?php
$con = mysql_connect("localhost"," "," ");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("backups", $con);
$sql="INSERT INTO `2007` (Month, Tape, Location)
VALUES
('$_POST[Month]','$_POST[Tape]','$_POST[Location]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Record added";
mysql_close($con);
?>
Any helpful pointers would be great!