Jump to content

can i get table name from FORM?


muzammil1

Recommended Posts

<html>

<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>

 

 

<?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);

?>

 

 

 

I am trying to create the table with a table name, and table name should be the one that is username. IS it possible? am i using the correct syntax????

Link to comment
https://forums.phpfreaks.com/topic/233475-can-i-get-table-name-from-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.