我正在尝试构建一些包含文本输入和按钮的代码。当我提交表单时,我想显示一条消息。
我的代码有效,但是当我超过平均1000行时,该程序无法运行,php显示此消息
Apache HTTP Server已停止工作
我想尝试将程序拆分为函数并将其更改为优化
码
???
这是我做的事情
if the first character is A and the second character is A
display "GROUP1-1"
else if the first character is A and the second character is B
display "GROUP1-2"
else if the first character is A and the second character is C
display "GROUP1-3"
else if the first character is A and the second character is D
display "GROUP1-4"
else if the first character is B and the second character is A
display "GROUP2-1"
else if the first character is B and the second character is B
display "GROUP2-2"
else if the first character is B and the second character is C
display "GROUP2-3"
我正在使用Notepad ++和easyPHP。 这是我的代码:
<html>
<head>
<meta charset="utf-8"/>
<title>
exercice
</title>
</head>
<body>
<form action="" method="post">
decoder ces caracteres
<input type = "text" name ="t" size="8"/>
<input type ="submit" name ="decoder" value="Decoder">
<?php
if(isset($_POST['t']))
{
if(($_GET['t'][0]=='A')&&($_POST['t'][1]=='A')) {
echo "GROUP1-1";
}
else
if(($_GET['t'][0]=='A')&&($_POST['t'][1]=='B')) {
echo "GROUP1-2";
}
else
if(($_GET['t'][0]=='A')&&($_POST['t'][1]=='C')) {
echo "GROUP1-3";
}
if(($_GET['t'][0]=='A')&&($_POST['t'][1]=='D')) {
echo "GROUP2-1";
}
else
if(($_GET['t'][0]=='B')&&($_POST['t'][1]=='A')) {
echo "GROUP2-1";
}
else
if(($_GET['t'][0]=='B')&&($_POST['t'][1]=='B')) {
echo "GROUP2-2";
}
else
if(($_GET['t'][0]=='B')&&($_POST['t'][1]=='C')) {
echo "GROUP2-3";
}
else
{
echo"erreur";
}
}
?>
</form>
</body>
</html>