diff --git a/edit.inc.php b/edit.inc.php
index bd62f46f..63e5ad30 100644
--- a/edit.inc.php
+++ b/edit.inc.php
@@ -21,7 +21,7 @@ if ($_POST && !$error && !isset($_GET["select"])) {
} elseif ($field["type"] == "timestamp") {
$set[] = " MODIFY " . idf_escape($name) . " timestamp" . ($field["null"] ? " NULL" : "") . " DEFAULT $val" . ($_POST["on_update"][bracket_escape($name)] ? " ON UPDATE CURRENT_TIMESTAMP" : "");
} else {
- $set[] = " ALTER " . idf_escape($name) . ($val == ($field["null"] ? "NULL" : "''") ? " DROP DEFAULT" : " SET DEFAULT $val");
+ $set[] = " ALTER " . idf_escape($name) . ($val == ($field["null"] || $field["type"] == "enum" ? "NULL" : "''") ? " DROP DEFAULT" : " SET DEFAULT $val");
}
}
}
diff --git a/editing.inc.php b/editing.inc.php
index cbac8fa5..295ada11 100644
--- a/editing.inc.php
+++ b/editing.inc.php
@@ -6,8 +6,8 @@ function input($name, $field, $value) {
if (isset($_GET["select"])) {
echo ' ';
}
- if ($field["null"]) {
- echo ' ';
+ if ($field["null"] || isset($_GET["default"])) {
+ echo ' ';
}
if (!isset($_GET["default"])) {
echo '';
@@ -21,7 +21,10 @@ function input($name, $field, $value) {
} else {
$first = (isset($_GET["select"]) ? 2 : 1);
$onchange = ($field["null"] || isset($_GET["select"]) ? ' onchange="var f = this.form[\'function[' . addcslashes($name, "\r\n'\\") . ']\']; f.selectedIndex = Math.max(f.selectedIndex, ' . $first . ');"' : '');
- $options = (preg_match('~char~', $field["type"]) ? array("", "md5", "sha1", "password", "uuid") : (preg_match('~date|time~', $field["type"]) ? array("", "now") : array("")));
+ $options = array("");
+ if (!isset($_GET["default"]) && preg_match('~char|date|time~', $field["type"])) {
+ $options = (preg_match('~char~', $field["type"]) ? array("", "md5", "sha1", "password", "uuid") : array("", "now"));
+ }
if ($field["null"]) {
array_unshift($options, "NULL");
}