我创建了一个index.php页面,该页面是由三个页面拼成的,代码如下:
<table width="1280" border="0" cellpadding="0" cellspacing="0"> <tr valign="top">
<td colspan="2">
<?php
include("top.php");
?>
</td>
</tr>
<tr valign="top">
<td width="586" valign="top" bgcolor="#FEFEF6"><?php include('main.php');?></td>
</tr>
<tr>
<td colspan="2"><?php include('bottom.php');?></td>
</tr>
</table>
我在main.php中使用ajax进行登陆验证,验证成功后 在原来的位置显示用户名。我遇到的问题是:当用户名验证成功后,跳转的页面是main.php页面,我怎么使她跳转到index.php页面,并且实现登录验证,并在登陆验证成功后,在index.php页面显示用户名。我是一个php菜鸟,求指导!!!PHPAjax登陆验证页面跳转出错
<table width="1280" border="0" cellpadding="0" cellspacing="0"> <tr valign="top">
<td colspan="2">
<?php
include("top.php");
?>
</td>
</tr>
<tr valign="top">
<td width="586" valign="top" bgcolor="#FEFEF6"><?php include('main.php');?></td>
</tr>
<tr>
<td colspan="2"><?php include('bottom.php');?></td>
</tr>
</table>
我在main.php中使用ajax进行登陆验证,验证成功后 在原来的位置显示用户名。我遇到的问题是:当用户名验证成功后,跳转的页面是main.php页面,我怎么使她跳转到index.php页面,并且实现登录验证,并在登陆验证成功后,在index.php页面显示用户名。我是一个php菜鸟,求指导!!!PHPAjax登陆验证页面跳转出错
第二个,不知道你的登录验证是写在哪个页面,写在index.php的话,Ajax的URL写index.php就行了
第三个,登录验证成功后把用户名写在session里面,在index中就可以显示了
一旦跳转,页面所用的内容都需要重新来过。
这样就失去了使用ajax的意义
echo "<br/> 欢迎您".$this->username;
header("location:index.php");
exit;
但是index.php中的内容重新来过。
如果不用跳转,验证成功后,跳到main.php页面。
echo "<br/> 欢迎您".$this->username;这句话不是要写在index.php里吗?
可以把$_SESSION[username] = $this->username
然后在index里echo "<br/> 欢迎您".$_SESSION[username];
什么是index里面的内容重新来过,里面有什么不能重新来过的东西吗