如何在此PHP代码中放入错误消息。 [英] How to put error message in this PHP code.
本文介绍了如何在此PHP代码中放入错误消息。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< html >
< head >
< title > 事件< / title >
< / head >
< body >
< 表格 action = damn.php method < span class =code-keyword> = 发布 >
< 输入 type =' text' 名称 =' nameeve' size =' < span class =code-keyword> 100' value =' 活动名称 >
< 输入 类型 =' text' name =' date ' size =' 10' value =' YY / DD / MM' >
<? php
foreach ($ _POST as $ dates){
if (isset($ dates) ){
if (preg_match(' / ^ [0-9] {1,} /',$ price [1])){
echo corret;
}
其他 {
echo 无效;
}
}
}
?>
< 输入 type = 提交 value = 提交 / >
< / form >
< / body >
< / html >
解决方案
_POST as
date){
if (isset(
dates)){
if (preg_match(' / ^ [0-9] {1,} /'跨度>,
<html>
<head>
<title>Event</title>
</head>
<body>
<form action="damn.php" method="post">
<input type='text' name='nameeve' size='100' value='Name of Event'>
<input type='text' name='date' size='10' value='YY/DD/MM'>
<?php
foreach ($_POST as $dates) {
if (isset($dates)) {
if (preg_match('/^[0-9]{1,}/', $price[1])) {
echo "corret";
}
else {
echo "invalid";
}
}
}
?>
<input type="submit" value="Submit" />
</form>
</body>
</html>
解决方案
_POST as
dates) { if (isset(
dates)) { if (preg_match('/^[0-9]{1,}/',
这篇关于如何在此PHP代码中放入错误消息。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文