I'm trying to build a widget for a client which would allow them to create a new table without logging into the phpMyAdmin, but I'm failing.
I can't figure out how to take some text that the client would input in page 1 and use it to create the table name in page 2.
Help?
---------------------------------------------------------
PAGE 1
---------------------------------------------------------
<html>
<h2>Create Table</h2>
</br>
<form action="/create_reg.php" method="post">
Table Name:<input type="text" name="title" />
</br>
<input type="submit" value="Create Table" />
</form>
</html>
---------------------------------------------------------
PAGE 2
---------------------------------------------------------
<?php
$con = mysql_connect("localhost","database","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
//CREATE TABLE
mysql_select_db("database", $con);
$sql = "CREATE TABLE ???????
(
line1 varchar(19),
line2 varchar(19)
)";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "You have successfully created the table.";
mysql_query($sql,$con);
mysql_close($con);
?>