• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • Upgrade Your Account
    Hello Guest! Upgrade your account to download all VIP Resource here

Anh em giúp sửa đoạn php if else với

Joined
Sep 27, 2016
Messages
53
Chủ thớt
#1
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/URL]"&gt;
<html xmlns="[URL]http://www.w3.org/1999/xhtml[/URL]"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Số lớn</title>
</style>
</head>

<body><?php $time=$_POST["time"];
$chao=if($time>="0" && $time<="13"){ echo"Сhào buổi sáng!!!";} else if($time>="13" && $time<="18"){ echo"Chào buổi chiều";} else if($time>="18&& $time<="24{ echo"Chào buổi tối";}?>
<form id="form1" name="form1" method="post" action="hl.php">
<table width="400" border="0" align="center" bgcolor="[HASHTAG]#CCFF99[/HASHTAG]">
<tr>
<td colspan="2″ align="center" bgcolor="#FF66CC″><h1 class="style1">Chào </>
</tr>
<tr>
<td><strong>số g</strong></td>
<td><label>
<input name="time" type="text" id="time" value="<?php echo $_POST["time" />
</label></td>
</tr>
<td><strong>chao</strong></td>
<td><label>
<input name="chao" type="text" id="chao" value="<?php echo $chao" readonly="true" style="background-color:[HASHTAG]#FF99FF[/HASHTAG]" />
</label></td>
</tr>
<tr>
<td colspan="2" align="center"><label>
<input type="submit" name="Submit" value="in"></label></td>
</tr>
</table>
</form>
</body>
</html>
. ae xem hộ ở cái đoạn if else. với.. mình mới học.. không biết lỗi ở đâu ..với sửa sao đây
 
Last edited by a moderator:
Joined
Dec 12, 2015
Messages
94
#2
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/URL]"&gt;
<html xmlns="[URL]http://www.w3.org/1999/xhtml[/URL]"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Số lớn</title>
</style>
</head>

<body><?php $time=$_POST["time"];
$chao=if($time>="0" && $time<="13"){ echo"Сhào buổi sáng!!!";} else if($time>="13" && $time<="18"){ echo"Chào buổi chiều";} else if($time>="18&& $time<="24{ echo"Chào buổi tối";}?>
<form id="form1" name="form1" method="post" action="hl.php">
<table width="400" border="0" align="center" bgcolor="[HASHTAG]#CCFF99[/HASHTAG]">
<tr>
<td colspan="2″ align="center" bgcolor="#FF66CC″><h1 class="style1">Chào </>
</tr>
<tr>
<td><strong>số g</strong></td>
<td><label>
<input name="time" type="text" id="time" value="<?php echo $_POST["time" />
</label></td>
</tr>
<td><strong>chao</strong></td>
<td><label>
<input name="chao" type="text" id="chao" value="<?php echo $chao" readonly="true" style="background-color:[HASHTAG]#FF99FF[/HASHTAG]" />
</label></td>
</tr>
<tr>
<td colspan="2" align="center"><label>
<input type="submit" name="Submit" value="in"></label></td>
</tr>
</table>
</form>
</body>
</html>
. ae xem hộ ở cái đoạn if else. với.. mình mới học.. không biết lỗi ở đâu ..với sửa sao đây
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/URL]"&gt;
<html xmlns="[URL]http://www.w3.org/1999/xhtml[/URL]"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Số lớn</title>
</style>
</head>

<body>
<?php 
$time=$_POST["time"];
if($time >= "0" && $time <= "13")
{ echo "Сhào buổi sáng!!!";}
 else if($time >= "13" && $time <= "18")
{ echo "Chào buổi chiều";} 
else if($time >= "18&& $time <= "24)
{ echo "Chào buổi tối";}
?>
<form id="form1" name="form1" method="post" action="hl.php">
<table width="400" border="0" align="center" bgcolor="[HASHTAG]#CCFF99[/HASHTAG]">
<tr>
<td colspan="2″ align="center" bgcolor="#FF66CC″><h1 class="style1">Chào </>
</tr>
<tr>
<td><strong>số g</strong></td>
<td><label>
<input name="time" type="text" id="time" value="<?php echo $_POST["time" />
</label></td>
</tr>
<td><strong>chao</strong></td>
<td><label>
<input name="chao" type="text" id="chao" value="<?php echo $chao" readonly="true" style="background-color:[HASHTAG]#FF99FF[/HASHTAG]" />
</label></td>
</tr>
<tr>
<td colspan="2" align="center"><label>
<input type="submit" name="Submit" value="in"></label></td>
</tr>
</table>
</form>
</body>
</html>
Thử xem được chưa, viết sai nhiều quá :3
 

Facebook Comment

Similar threads


Users who viewed this discussion (Total: 0)


New posts New resources Most viewed threads Threads with more replies