搜尋

首頁  >  問答  >  主體

請問提交表單是空白是哪裡出錯了

<?php

if(trim($_POST['password']) != trim($_POST['repassword'])){

exit ("兩次使用的密碼不一致,請返回上一頁");

}

# $username = trim($_POST['username'] );

$password = md5(trim($_POST['password']));

$conn = mysqli_connect('localhost ','root','root','informationtest','3306');

if(mysqli_error($conn)){

mysqli_error($conn);

exit;

}

mysqli_select_db($conn,'my_my');

# mysqli_set_charset($conn, 'utf8');

insert into informationtest (id,name,password,) value('','$username','$password');

?>


  2632 天前1796

全部回覆(7)我來回復

  • dabour

    dabour2017-12-07 15:58:35

    你是直接存取了那個文件,而不是透過伺服器存取的

    回覆
    1
  •  

    是的,謝謝我解決了

      · 2017-12-09 18:50:46
  • 路过

    路过2017-12-05 08:24:07

    那你要看html 是不是沒有name

    回覆
    0
  •  

    有name,後來我發現除了火狐,其他瀏覽器是直接顯示php程式碼

      · 2017-12-05 18:24:57
     

    <正文> <表單操作=“connect.php”方法=“POST”> <表格邊框=“1”樣式=“邊距:100px自動”> <tr> 使用者名稱 <td><輸入類型=“文字”名稱=“使用者名稱”/></td> 密碼 <td><輸入類型=“密碼”名稱=“密碼”/></td> </表> </表格> </正文> //以上是html程式碼

      · 2017-12-05 18:27:51
     

    搞定了,百度的:直接localhost訪問網站目錄 假設你有一個靜態頁index.html,將靜態頁拷到你的網站目錄,然後是用localhost/index.html訪問

      · 2017-12-05 19:23:57
     

    我用Notepad++開啟瀏覽器的,顯示的位址是file:///D:/phpStudy/PHPTutorial/WWW/login.html這樣的,不是localhost/login.html,所以導致html跳轉直接顯示php程式碼。雖然解決了,但原理還是懵逼。

      · 2017-12-05 19:26:11
  • 取消回覆