提交按钮已变为文本框

时间:2015-08-24 15:55:10

标签: php sql forms

http://lindsaymacvean.com/wuwo/activlist/sql_update.php

我试图从这个问题中实现一个简单的表格。

#1273 - Unknown collation: 'utf8mb4_unicode_ci' Cpanel

我看到一个文本框,其中提交按钮应该是,我不知道为什么?

UPDATE 对于那些看到带空格的代码的人来说,这不是原始文件所显示的。

<!DOCTYPE html>
<html>
<head>
  <title>DB-Convert</title>
  <style>
    body { font-family:"Courier New", Courier, monospace;" }
  </style>
</head>
<body>

<h1>Convert your Database to utf8_general_ci!</h1>

<form action="sql_update.php" method="POST">
  dbname: <input type="text" name="dbname"><br>
  dbuser: <input type="text" name="dbuser"><br>
  dbpass: <input type="text" name="dbpassword"><br>
  <input type="submit">
</form>
version 1

</body>
</html>
<?php
if ($_POST) {
  $dbname = $_POST['dbname'];
  $dbuser = $_POST['dbuser'];
  $dbpassword = $_POST['dbpassword'];

  $con = mysql_connect('localhost',$dbuser,$dbpassword);
  if(!$con) { echo "Cannot connect to the database ";die();}
  mysql_select_db($dbname);
  $result=mysql_query('show tables');
  while($tables = mysql_fetch_array($result)) {
          foreach ($tables as $key => $value) {
           mysql_query("ALTER TABLE $value CONVERT TO CHARACTER SET utf8   COLLATE utf8_general_ci");
     }}
  echo "<script>alert('The collation of your database has been successfully changed!');</script>";
}

?>

3 个答案:

答案 0 :(得分:0)

删除所有内容之间的间距,它应该有效。

<form action="sql_update.php" method="POST">
  dbname: <input type="text" name="dbname"><br>
  dbuser: <input type="text" name="dbuser"><br>
  dbpass: <input type="text" name="dbpassword"><br>
  <input type="submit">
</form>

示例

http://jsfiddle.net/w2c507ud/

答案 1 :(得分:0)

尝试改变,

<input type=" submit ">

<input type="submit" name="submit" value="submit">

答案 2 :(得分:0)

出错
 body { font-family:"Courier New", Courier, monospace;" }

应该是

body { font-family:"Courier New, Courier, monospace;" }