2014-02-09 1 views
0

을 제출하면 제출 버튼이 표시되지 않습니다. 등록 양식을 만들었고 등록을 눌러야 만 제외하고 모든 것이 정상적으로 작동합니다. 등록을 다시해야하지만 그 이유는 알 수 없습니다. 내가 그것을 여기 나 좀 도와주십시오 참조 그나마 사촌 코드의 실수 .. 내가 등록 버튼 (등록/로그인 시스템 PHP)

input.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" 
:

<?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'; 
?> 

답변

0

""같은 형태로 동작을 유지할 수로

if(input::exists()) { 
echo 'Submitted'; 
} 

당신은 무엇을해야

,626

그것에

<form action="" method="post"> 
0

이 버튼은 양식

</form> 
을 닫아야을 통해 당신이

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

더해야

<input type="submit" value="Register" 

폐쇄되지 않았습니다또한 폼 액션 = ""이 값을 얻으려면 $ _GET [ "username"] 등이 필요합니다. 함수 exists()의 기본 유형은 포스트이므로 폼 메서드를 post 또는 호출 할 때 필요합니다.

if(input::exists("get")) { 
echo 'Submitted'; 
} 

그래서 두 번째 경우에 당신은 내가 문제를 발견

+0

를 게시물을 넣어 잊어하지만 여전히 나는 내 업데이트 대답 확인 – lenart95

+0

버튼을 누를 때 제출 한 텍스트를 가져니까. –