I have a 형 한 페이지에 있는 다른 페이지로 제출됩니다. 이 메일은 거기 있는지 확인합니다 입력입니다 칠해집니다. 그렇다면 뭔가 채워지지 재동기화할 경우, 일을 할 수가 없어요. 왜 항상 내가 이해하지 don& # 39, 세트, 만약에 내가 전송하십시오 빈 양식이 있다고 말했다. 지정하십시오. 누락되거나 잘못된?
step2.php:
<form name="new user" method="post" action="step2_check.php">
<input type="text" name="mail"/> <br />
<input type="password" name="password"/><br />
<input type="submit" value="continue"/>
</form>
step2_check:
if (isset($_POST["mail"])) {
echo "Yes, mail is set";
} else {
echo "N0, mail is not set";
}
간단히 사용할 수 있습니다.
if($_POST['username'] and $_POST['password']){
$username = $_POST['username'];
$password = $_POST['password'];
}
빈 () 또는 사용
if(!empty($_POST['username']) and !empty($_POST['password'])){
$username = $_POST['username'];
$password = $_POST['password'];
}
다음 속성을 추가합니다 텍스트 입력 폼. ',' required" " 필수 =. 만약 사용자가 지정할 수 있도록 제출됩니다 폼 양식 채워지지 않을 것이다.
이제 새 코드를 것입니다.
<form name="new user" method="post" action="step2_check.php">
<input type="text" name="mail" required="required"/> <br />
<input type="password" name="password" required="required"/><br />
<input type="submit" value="continue"/>
if (isset($_POST["mail"])) {
echo "Yes, mail is set";
}
빈 () '대신' 사용 '! 이세 ()'. 네 경우엔 복귀하십시오 이세 때문에 ' ()' 가 항상 true.
if (!empty($_POST["mail"])) {
echo "Yes, mail is entered";
} else {
echo "No, mail is not entered";
}
<form name="new user" method="post" action="step2_check.php">
<input type="text" name="mail" required="required"/> <br />
<input type="password" name="password" required="required"/><br />
<input type="submit" value="continue"/>
</form>
<?php
if (!empty($_POST["mail"])) {
echo "Yes, mail is set";
}else{
echo "N0, mail is not set";
}
?>
그동안 제출됨 필드를 먼저 양식 있는지 확인합니다. 이를 막기 위해 현장 살균 할 수도 있습니다.
"' 양식 이름 = ", 새로운 user". 방법 = " post"; action = " step2_check.php" >;; < 입력입니다 유형 = " text";; name = " mail" />;; br /> <; < 입력입니다 유형 = " password";; name = " password" /> <, br />;;; < 입력입니다 유형 = " submit";; id = " SubmitForm"; name = " SubmitForm"; 값 = " continue" />;; < /form>; ""
step2_check:
"'
if (이세 ($ _POST [" SubmitForm";]) { = $ 전자_메일 sanitize_text_field (스트리프스래시스 ($ _POST [" SubmitForm";])); if (! 빈 ($ 전자_메일)) 에코 " 그러하너라 mail) 은 set";; 다른 에코 " N0, 메일 set" 없습니다;;; } }
"'
이것은 당신의 HTML 형식으로 step2.php 생각할 수 있습니다.
>. step2.php
<form name="new user" method="post" action="step2_check.php">
<input type="text" name="mail"/> <br />
<input type="password" name="password"/><br />
<input type="submit" value="continue"/>
</form>
I think you 필요로 할 수 있도록 php, HTML 양식을 할당하십시오 데이터베이스에 대한 가치를 이제 진짜 이스케이프입니다 문자열 변수를 사용할 수 있습니다, 아래 너회의 있어야 합니다.
>. step2_check.php
if(isset($_POST['mail']) && !empty($_POST['mail']))
{
$mail = mysqli_real_escape_string($db, $_POST['mail']);
}
여기서 $ db 는 고객 데이터베이스 연결.
응답하는 게시하기를 질문: 3) 과 함께 빈 이세 보기입니다 로드하십시오. 아약스는 이 Javascript 를 이용할 수 있는 명령을 잘 알려져 있다.
$errMess="Didn't test"; // This message should not show
if(isset($_POST["foo"])){ // does it exist or not
$foo = $_POST["foo"]; // save $foo from POST made by HTTP request
if(empty($foo)){ // exist but it's null
$errMess="Empty"; // #1 Nothing in $foo it's emtpy
} else { // exist and has data
$errMess="None"; // #2 Something in $foo use it now
}
} else { // couldn't find ?foo=dataHere
$errMess="Missing"; // #3 There's no foo in request data
}
echo "Was there a problem: ".$errMess."!";
이 문제를 해결할 수 있습니다.
if (isset($_POST["mail"]) !== false) {
echo "Yes, mail is set";
}else{
echo "N0, mail is not set";
}