|
Posted by Magic Bean on 09/05/05 06:59
Hi there.
I am trying to figure out how to make a table from a form.
It doesn't seem to be working.
Also you might notice that I am trying to make the table name dynamic.
Could someone check this over and let me know what the problem might be?
Thank you
Puto
<?php
$connect = @mysql_connect(server', 'login', 'pass');
if (!$connect) { // The ! means this - If it doesn't connect
echo ( '<P> Unable to connect to database ' . ' database server at this
time.</p>' );
exit();
}
mysql_select_db ('magicbean', $connect); //Select the Database at this
address with this login info.
if (! @mysql_select_db('magicbean') ) {
die ( '<p> Unable to connect to The Database ' . ' at this time.</p>' );
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
$query = "CREATE TABLE $username
( id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(20) NOT NULL,
PRIMARY KEY(id))";
$result = mysql_query($query);
$username = $_POST['party'];
?>
<form action="<?php echo $result;?>" method="post">
<table width="392" border="0" cellpadding="0">
<tr>
<th scope="col">Please enter the ID for the new party. </th>
</tr>
<tr>
<td><div align="center">
<input type="text" name="party" />
</div></td>
</tr>
<tr>
<td><div align="center">
<input type="submit" name="Submit" value="Submit" />
</div></td>
</tr>
</table>
</form>
</body>
</html>
Navigation:
[Reply to this message]
|