login.html<html><head>?<title>注冊頁面</title>?<meta charset="utf-8"></head><body><form action="log.php?action=1" method="post">??? 請輸入姓名 <input type = "text" name = "username" > <br>??? 請輸入密碼 <input type="password" name="password" ><br>??? 您的性別是:<input type="radio" name="sex" value="1">男??????????????? <input type="radio" name="sex" value="2">女<br>??? 您的郵箱是:<input type="emile" name="emile"><br>??? 您的心情是:<select name="mood">??? <option value="A" >開心</option>??? <option value="C" >憂郁</option>??? <option value="B" >迷茫</option>?????????????? </select><br>??? 您的愛好是:<br><input type="checkbox" name="fav[]" value="籃球">籃球<input type="checkbox" name="fav[]" value="足球">足球<input type="checkbox" name="fav[]" value="乒乓球">兵乓球<input type="checkbox" name="fav[]" value="其他" checked>等等<br>??? 您對這個表單的意見:<br>??? <textarea name="desp" row="60" col="50">感謝您的意見。。。</textarea><br>??? <button type="reset" name="reload" >刷新</button> ??? <input type = "submit" name = "submit1" value="確定"><br></form></body></html>log.php<!DOCTYPE html><html><head>?<title></title></head><body><?phpif(isset($_REQUEST['action'])&&$_REQUEST['action']==1){$username=$_POST['username'];$password=$_POST['password'];$sex=$_POST['sex'];$emile=$_POST['emile'];$mood=$_POST['mood'];$fav=$_POST["fav[]"];// echo "用戶名是{$username},密碼是{$password}";setcookie("username",$username,time()+10*60);setcookie("password",md5($password),time()+10*60);setcookie("sex",$sex,time()+10*60);setcookie("emile",$emile,time()+10*60);setcookie("mood",$mood,time()+10*60);setcookie("fav",$fav,time()+10*60);setcookie("login",1,time()+10*60);}elseif (isset($_REQUEST['action'])&&$_REQUEST['action']==2) {setcookie("username",'',time()-10*60);setcookie("login",0,time()-10*60);}header("Location:text.php");?></body></html>不知道為什么,fav[]的值無法存入cookieQAQ小白求助~+。+
- 1 回答
- 0 關(guān)注
- 1438 瀏覽
添加回答
舉報
0/150
提交
取消