# Adding Database Form

**URL:** <https://forum.kirupa.com/t/adding-database-form/142695>\
**Category:** Uncategorized\
**Created:** [March 30, 2005, 9:27pm UTC](https://forum.kirupa.com/t/adding-database-form/142695 "2005-03-30T21:27:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)\
**Post date:** [March 30, 2005, 9:27pm UTC](https://forum.kirupa.com/t/adding-database-form/142695/1 "2005-03-30T21:27:00Z")

</div>

I have a PHP file that lists all the current databases and allows the user to add in databases via a form.

I get a completey blank page when I view the following PHP file (username and password have been purposely concealed, and I am sure the connection works with the real PW and username). The problem has to do with the top PHP, because when I remove it, the page is not blank anymore (although it won’t list out the databases of course).

```php

<?php 
$conn = @mysql_connect("localhost", "username", "password") or die("could not connect");

$rs1 = @mysql_create_db($_REQUEST['db']);
$rs2 = @mysql_list_dbs($conn);

for($row = 0; $row < mysql_num_rows($rs2); $row++)
{
	$list .= mysql_tablename($rs2, $row) . " | ";
}
?>

<html>
<body>

<form action = "<?php echo($_SERVER['PHP_SELF']); ?>" method="post">
Current Databases: <?php echo($list); ?> 
<hr>
Name: <input type ="text" name ="db"> <input type="submit" value="Create database">
</form>

</body>
</html>

```
