so im working on an php script that will do a couple of things. First it will take ip,email, and two dates from a user in a form. It will insert these into a table and then using the IP as the key, it will remove the row from table 1(the original table) into table 2(identical to table 1 except with addition of IP,email and two dates. I keep getting undefined comment error, not sure why and also, no SQL action is performed. Any help or guidance will be appreciated!
<?php
$connect = mysqli_connect("reserve1",
"root", "","server_31");
$status = "";
if(isset($_POST['new']) &&
$_POST['new']==1){
$IPAddress = $_REQUEST['IPAddress'];
$email = $_REQUEST['email'];
$Date_reserved =
$_REQUEST['date_reserved'];
$Date_returned =
$_REQUEST['date_returned'];
$sql="INSERT INTO 'servers_in_use'
(`IPAddress`,'Email'`Date_Reserved`,
`Date_Returned`,) VALUES
('$IPAddress','$email','$Date_reserved',
'$Date_returned',)";
$sql="INSERT INTO 'servers_in_use'
SELECT * FROM 'servers' WHERE IPAddress=
$IPAddress";
$sql="DELETE FROM servers WHERE
IPAddress =$IPAddress";
mysqli_query($connect, $sql);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Make a Reservation</title>
<link rel="stylesheet"
href="css/style.css"
/>
</head>
<body>
<div class="form" align="center">
<p><a href="dashboard.php">Main Menu</a>
| <a href="view.php">View Available
Servers</a>
| <a href="view.php">View Reserved
Servers</a>
<div align ="center">
<h1>Make A Reservation</h1>
<form name="form" method="post" action="">
<input type="hidden" name="new" value="1"
/>
<p><input type="text" name="IP Addrress"
placeholder="Enter Server IP" required />
</p>
<p><input type="email" name="Email"
placeholder="Enter Email" required /></p>
<p><input type="date" name="Date Reserved"
placeholder="Enter Date" required /></p>
<p><input type="date" name="Date Returned"
placeholder="Enter Date" required /></p>
<p><input name="submit" type="submit"
value="Submit" /></p>
</form>
<p style="color:#FF0000;"><?php echo
$status; ?></p>
</div>
</div>
</body>
</html>
Errors:
Notice: Undefined index: IPAddress
Notice: Undefined index: email
Notice: Undefined index: date_reserved
Notice: Undefined index: date_returned