例如
先是一个登陆页
<body>
<form method="post" action="mission.php">
用户名
<input type="text" size="15" name="name" /><p>
密码
<input type="password" size="15" name="password" /><p>
<input type="submit" value="提交" />
</form>
</body>提交后
mission.php
可以获得
name\password两个变量mission中有一个子框架
<div class="note">
<iframe src="note.php" name="note" width="247px" height="630px"></iframe>
</div>怎么让子框架中的note.php也获得mission.php所获得的name和password两个变量?

解决方案 »

  1.   

    登陆成功后,
    把值存在SESSION里。
      

  2.   

    +++将值存放在session里面,然后利用session取出来的。
      

  3.   


    请问代码应该怎么写,我是新手啊,不会我自己写的是
    mission.php
    <?php
    $link=mysql_connect('localhost','root','');
    mysql_select_db('note',$link);
    $name=$_POST['name'];
    $password=$_POST['password'];
    $query="select * from mission
    where name='$name'
    and password='$password'";
    $result=mysql_query($query,$link);
    $num_row=mysql_num_rows($result);
    if($num_row){
    $row=mysql_fetch_array($result);
    session_start();
    $_session['username']=$row['name'];print("
    <html>
    <meta http-equiv=Content-Type content=text/html; charset=utf-8/>
    <title>Your mission everday</title>
    <head>
    <link rel=stylesheet type=text/css href=all.css>
    </head>
    <body>");print("<div class=note>
    <iframe src=note.php name=note width=247px height=630px></iframe>
    </div>");
    }
    note.php<?php
    session_start();
    $link=mysql_connect('localhost','root','');
    mysql_select_db('note',$link);
    $name=$_session['username'];
    echo ".$name.";
    $query="select * from mission
    where name='$name'
    ";
    $result=mysql_query($query,$link);
    $num_row=mysql_num_rows($result);
    /*
    if($num_row){
    */
    $row=mysql_fetch_array($result);
    print("
    <html>
    <meta http-equiv=Content-Type content=text/html; charset=utf-8/>
    <title>Your mission everday</title>
    <head>
    <link rel=stylesheet type=text/css href=all.css>
    </head>
    <body>");
    print("<div><a><font face=Arial, Helvetica, sans-serif>");
    echo "Note here";
    print("</font></a></div>");print("
    <div class=note2><form method=post action=notenew.php >
    <textarea name=notenew id=notenew rows=36 cols=30 wrap=soft>
    $row[note]
    </textarea>
    <input type=hidden name=name value=$name> 
    <input type=submit value=提交>
    </form>
    </div>
    ");
    ?>
    但是$_session['username'] 并没有获得值啊
      

  4.   

    你看看你的phpinfo.php文件看支不支持session功能。
      

  5.   

    不是
    $_session['username']

    $_SESSION['username'];