layer += '<div class="layer_title"><h1>注冊</h1><a href="javascript:;" title="關閉">x</a></div>';
layer += '<form action="register.php" method="POST" id="registerForm"><ul>'; //layer_cont
layer += '<b>*</b>:</span><input type="hidden" name="uniqid" id="uniqid" value="<?php $st?>"/>';
layer += '<li><span>賬 號<b>*</b>:</span><input type="text" class="layer_txt" placeholder="至少兩位" name="username" id="uname" /></li>';
layer += '<li><span>密 碼<b>*</b>:</span><input type="password" class="layer_txt" placeholder="至少六位" name="password" id="pwd" /></li>';
layer += '<li><span>確認密碼<b>*</b>:</span><input type="password" class="layer_txt" placeholder="至少六位" name="notpassword" id="repwd" /></li>';
layer += '<li><span>電子郵箱<b>*</b>:</span><input type="text" class="layer_txt" placeholder="您常用的郵箱地址" name="email" id="email" /></li>';
layer += '</form></ul>';
layer += '<div class="layer_btn"><input type="button" id="ressub" class="layer_submit_btn" value="提交" /></div>';
<?php
$_SESSION['st']=$st=sha1(uniqid[rand(),true));
?>
這樣寫不行的,但我不知道怎樣寫了。
如果在JS表單跳轉後的一個驗證表單的PHP文件裡面再去寫可以嗎。。但那時候生成的uniqid是不是又變了
應該在php生成唯一標准,放入你的表單中
<?php
$_SESSION['st']=$st=sha1(uniqid[rand(),true));
?>
layer += '<div class="layer_title"><h1>注冊</h1><a href="javascript:;" title="關閉">x</a></div>';
layer += '<form action="register.php" method="POST" id="registerForm">';
layer += '<input type="hidden" name="st" value="<?php echo $st;?>"/>'; //添加隱藏控件存儲唯一id
layer += '<ul>'; //ul放下來
layer += '<b>*</b>:</span><input type="hidden" name="uniqid" id="uniqid" value="<?php $st?>"/>';
layer += '<li><span>賬 號<b>*</b>:</span><input type="text" class="layer_txt" placeholder="至少兩位" name="username" id="uname" /></li>';
layer += '<li><span>密 碼<b>*</b>:</span><input type="password" class="layer_txt" placeholder="至少六位" name="password" id="pwd" /></li>';
layer += '<li><span>確認密碼<b>*</b>:</span><input type="password" class="layer_txt" placeholder="至少六位" name="notpassword" id="repwd" /></li>';
layer += '<li><span>電子郵箱<b>*</b>:</span><input type="text" class="layer_txt" placeholder="您常用的郵箱地址" name="email" id="email" /></li>';
layer += '</form></ul>';
layer += '<div class="layer_btn"><input type="button" id="ressub" class="layer_submit_btn" value="提交" /></div>';
$st=$_POST["st"];