Posted by walterbyrd on 11/18/64 11:43
I am trying to get user input from a php form. Problem is: the form
doesn't wait for the user to press the submit button, but falls right
through. Therefore the variable I am trying to get, is never set. I
know it has to be something simple, but I'm missing it. Here is the
code:
echo "<form action=\"$PHP_SELF\" method=\"post\">";
echo "Name of new database to create: ";
echo "<br><input type=\"text\" name=\"new_db\">";
echo "<input type=\"submit\" value=\"submit\"><br><br>";
if ($new_db)
{
$create_db = 'CREATE DATABASE '.$new_db;
if (mysql_query($create_db, $conn))
{
echo "Database $new_db created successfully\n";
}
else
{
echo 'Error creating database: ' . mysql_error() . "\n";
}
}
else
{
echo ("new database not created");
};
[Back to original message]
|