Hello,i have this html form.
<html>
<body>
<form action="create.php" method="post">
Class: <input type="text" name="class" />
Year: <input type="text" name="year" />
<input type="submit" />
</form>
</body>
</html>
I want to create using the post values,possibly concatenate class.year and that will be the table name in mysql.
<?php
$con = mysql_connect("localhost","wikinger","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// Create database
if (mysql_query("CREATE DATABASE my_db",$con))
{
echo "Database created";
}
else
{
echo "Error creating database: " . mysql_error();
}
// Create table
mysql_select_db("my_db", $con);
$sql = "CREATE TABLE Persons
//How do i replace Persons with '$_POST[class]'.'$_POST[year]'
(
FirstName varchar(15),
LastName varchar(15),
Age int
)";
// Execute query
mysql_query($sql,$con);
mysql_close($con);
?>
I want to use '$_POST[class]'.'$_POST[year]' as my table name.How do i do it in my case?.