我有PHP代码应该在PHP代码中有访问代码。当您转到该页面时,您输入了访问代码,如果正确,则继续访问另一页,否则会显示错误消息。
这是我的代码:
b = ('Traditionally, companies have been communicating', 'with consumers through traditional or old media.', 'The rapid changes in the cyber world.')
i=0
a=[]
num=0
for element in b:
print(element)
if element[i][0].islower():
a[-1]=a[-1]+element
else:
a.append(element)
num=num+1
print(a)
答案 0 :(得分:0)
这应该让你开始。
这两个变量对于初学者来说是不同的。他们可以匹配。查看isset函数和空函数。我检查是否存在该值,如果存在,我验证它。如果没有,只需显示表单,不要尝试验证任何内容。
<?php
$code = isset( $_POST['code'] ) ? $_POST['code'] : NULL;
$codeToMatch = '7613';
if ( ! empty( $code ) )
{
if( $code == $codeToMatch ) {
echo "it worked!";
} else {
echo "it did not work !";
}
}
?>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<input type="password" name="code" />
<input type="submit" name="submit" value="Submit" />
</form>
答案 1 :(得分:0)
我修好了
<强> CODE:强>
{{1}}