所以我做了一個註冊表單,除了當我按下注冊時它應該可以正常工作,它應該給我回註冊但是它不是我不知道爲什麼在代碼中的錯誤因爲我沒有看到它,請幫我在這裏..我沒有得到提交按鈕,當我按下注冊(註冊/登錄系統的PHP)
register.php:
<?php
require_once 'core/init.php';
if(input::exists()) {
echo 'Submitted';
}
?>
<form action="" method="">
<div class="field">
<label for="username">Username</label>
<input type="text" name="username" id="username" value="" autocomplete="off">
</div>
<div class="field">
<label for="password">Create a password</label>
<input type="password" name="password" id="password">
</div>
<div class="field">
<label for="password_again">Enter your password again</label>
<input type="password" name="password_again" id="password_again">
</div>
<div class="field">
<label for="name">Enter your password again</label>
<input type="text" name="name" id="name">
</div>
<input type="submit" value="Register"
input.php:
<?php
class input {
public static function exists($type = 'post') {
switch($type) {
case 'post':
return (!empty($_POST)) ? true : false;
break;
case 'get':
return (!empty($_GET)) ? true : false;
break;
default:
return false;
break;
}
}
}
和的init.php
<?php
session_start();
$GLOBALS ['config'] = array(
'mysql' => array(
'host' => '127.0.0.1',
'username' => 'root',
'password' => '',
'db' => 'lr'
),
'remember' => array(
'cookie_name' => 'hash',
'cookie_expiry' => 604800
),
'session' => array(
'session_name' => 'user'
)
);
spl_autoload_register(function($class) {
require_once 'classes/' . $class . '.php';
});
require_once 'functions/sanitize.php';
?>
但我仍然沒有得到提交的文字時,我按下按鈕 – lenart95
檢查我的更新回答。 –