1.如果在注册时有空的信息没填,弹出一个窗口,告诉你不能留空.比如if($username=="") {}
在{}之间该怎么写代码?答:
echo "<script>alert('用户名不能为空')</script>";
exit;2.修改注册消息时,我做的是连接文本文件的,不是数据库,怎么把存这个用户的一整行改掉,我用$fp=fopen("a.txt","w")或是$fp=fopen("a.txt","a")都不行啊!
答:
你得定位到要修改的行或数据,可以用fseek或file出数组来改
在{}之间该怎么写代码?答:
echo "<script>alert('用户名不能为空')</script>";
exit;2.修改注册消息时,我做的是连接文本文件的,不是数据库,怎么把存这个用户的一整行改掉,我用$fp=fopen("a.txt","w")或是$fp=fopen("a.txt","a")都不行啊!
答:
你得定位到要修改的行或数据,可以用fseek或file出数组来改
alert("用户名不能为空");
return false;
}
可以显示提示信息框!
<input type="submit" value="提交" onClick="javascript:if(form1.username.value.length=="0"){alert('用户名不能为空');return false;}">
2,用unset
<?php
$file="usrdata.php";
$id="2";//要删除的行数
$arr=file($file);
unset($arr);
$newdata=impload("",$arr);
fwrite(fopen($file,"w+"),$newdata);
echo"删除成功";