이것은 내 문의 레지스트리 페이지이지만 PHP의 인증 코드가 작동하지 않는 이유가 있습니다. 도와주세요. 그것은 내 학교 일에 필요합니다.확인 코드가 PHP에서 작동하지 않습니다
<head>
<title>
Inquiry Form
</title>
</head>
<body>
<br>
<p>
<h1 style="color:blue; align:center;">
INQUIRY FORM
</h1>
</p>
<br>
<br>
<?php
$companynameErr = $emailErr = $phonenumberErr = $roadnameErr = $cityErr = $postcodeErr ="";
$companyname = $email = $phonenumber = $roadname = $city = $postcode = "";
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if (empty($_POST["companyname"]))
{$companynameErr = "Company name is required";}
else
{$companyname = test_input($_POST["companyname"]);
}
if (empty($_POST["email"]))
{$emailErr = "Email is required";}
else
{
$email = test_input($_POST["email"]);
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email))
{
$emailErr = "Invalid email format";
}
}
if (empty($_POST["phonenumber"]))
{$phonenumberErr = "Phone number is required";}
else
{$phonenumber = test_input($_POST["phonenumber"]);
}
if (empty($_POST["roadname"]))
{$roadnameErr = "Road name is required";}
else
{$roadname = test_input($_POST["roadname"]);
}
if (empty($_POST["city"]))
{$cityErr = "City is required";}
else
{$city = test_input($_POST["city"]);
}
if (empty($_POST["postcode"]))
{$postcodeErr = "Postcode is required";}
else
{$postcode = test_input($_POST["postcode"]);
}
}
function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<form name="form1" action="signup_ac.php" method="post">
<table border="1" style="width:30%; align: center;">
<tr>
<td style="width:50%; align:center;">
<h3>
Company name:
</h3>
</td>
<td>
<input type="text" name="companyname" size=60>
<span class="error">* <?php echo $companynameErr;?></span>
</td>
</tr>
<tr>
<td style="width:50%; align:center;">
<h3>
Telephone number:
</h3>
</td>
<td>
<input type="number" name="phonenumber" size=60>
<span class="error">* <?php echo $phonenumberErr;?></span>
</td>
</tr>
<tr>
<td style="width:50%; align:center;">
<h3>
Email:
</h3>
</td>
<td>
<input type="text" name="email" size=60>
<span class="error">* <?php echo $emailErr;?></span>
</td>
</tr>
<tr>
<td style="width:50%; align:center;">
<h3>
Road/Street name:
</h3>
</td>
<td>
<input type="text" name="roadname" size=60>
<span class="error">* <?php echo $roadnameErr;?></span>
</td>
</tr>
<tr>
<td style="width:50%; align:center;">
<h3>
City:
</h3>
</td>
<td>
<input type="text" name="city" size=60>
<span class="error">* <?php echo $cityErr;?></span>
</td>
</tr>
<tr>
<td style="width:50%; align:center;">
<h3>
Postcode:
</h3>
</td>
<td>
<input type="text" name="postcode" size=60>
<span class="error">* <?php echo $postcodeErr;?></span>
</td>
</tr>
<tr>
<td colspan="2" align=center>
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>
</body>
내 signup_ac.php 포함
(이 있지만, 자세한 내용에 대한 유감이 필요하고 있었고, 난 그렇게 쓰기이 브래킷 ladfhsdufbghisafg 삭제하시기 바랍니다 해야할지하지 않았다 hbsdchjnosdyhfsidufynhisdgfltbugisduafnhsldufgsidflgsidnfuhsdifusgdifudsgainfusgdafiusnfhnsdgfisudanfgilsdufghs, dufhnilsdkufhdikfungsisdjfylisaf.m, uhsl) :
<?php
include('config.php');
$tbl_name=temp_members_db;
$confirm_code=md5(uniqid(rand()));
$companyname=$_POST['companyname'];
$email=$_POST['email'];
$phonenumber=$_POST['phonenumber'];
$roadname=$_POST['roadname'];
$city=$_POST['city'];
$postcode=$_POST['postcode'];
$sql="INSERT INTO $tbl_name(confirm_code, companyname, email, phonenumber, roadname, city, postcode)VALUES('$confirm_code', '$companyname', '$email', '$phonenumber', '$roadname', '$city', '$postcode')";
$result=mysql_query($sql);
if($result){
$to=$email;
$subject="Your confirmation link here";
$header="from: SK Azmayeen Reshad <[email protected]>";
$message="Your Comfirmation link \r\n";
$message.="Click on this link to activate your account \r\n";
$message.="http://localhost/myphpproject/Controlled/confirmation.php?passkey=$confirm_code";
$sentmail = mail($to,$subject,$message,$header);
}
else {
echo "Not found your email in our database";
}
if($sentmail){
echo "Your Confirmation link Has Been Sent To Your Email Address.";
}
else {
echo "Cannot send Confirmation link to your e-mail address";
}
?>
을
"PHP에서 _code가 작동하지 않습니다." "조금 자세하게 설명해 주시겠습니까? – csmckelvey
입력란에 입력했는지 확인하는 확인이 수행되지 않고 곧바로 작업으로 넘어갑니다. 그냥 필드를 확인하지 않습니다. – user2836146