forked from danalex97/Projects-Fall-2015
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy_table.php
executable file
·50 lines (34 loc) · 959 Bytes
/
copy_table.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<head>
<link rel="stylesheet" type="text/css" href="style3.css">
</head>
<?php
$severname = "localhost";
$username = "root";
$password = "";
$conn = mysqli_connect($severname,$username,$password);
if ( $conn === false ) { die("Connection failed:".mysqli_connect_error()); }
$database = "dummy";
mysqli_query($conn, "use $database");
$sql = "show tables";
$result = mysqli_query($conn, $sql);
$options = array( 0 );
while( $row = mysqli_fetch_array($result) )
{
$options[++$options[0]] = $row[0];
}
echo "<form action=\"take_copy.php\" method=\"post\">\n";
echo "<p>";
echo "Colectivul copiat:";
echo "<select name=\"from\">\n";
for ($i=1;$i<=$options[0];++$i)
{
echo "<option value=\"$options[$i]\"> $options[$i] </option>";
}
echo "</select>\n<br>";
echo "Numele copiei: ";
echo "<input type=\"text\" name=\"to\" placeholder=\"nume\">\n";
echo "<input type=\"submit\" value=\"Trimite\">\n </form>";
echo "</p>";
?>
<html>
</html>