<head>
</head>
<body>
<form name="register" action="create.php" method="post">
username:<input type="text" name="user" />
e-mail:<input type="text" name="email" />
<input type="submit" name="submit" value="register" />
</form>
</body>
</html>
I am tryna to create a table and the name of the table should be the one that is user name. I m tryin following code. Its not working for me. Please help. Or is it even possible.
Code: Select all
<?php //create.php
$u=$_POST['user'];
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE TABLE '$u'",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}
mysql_close($con);
?>