-   Programming (
-   -   php, iframes and loading a page (

poeta_boy 03-14-2005 01:54 AM

php, iframes and loading a page
Hello Mina San:

I'm bulding an small site based on php and I have a page Login.php, which in turn has an iframe coming from loginForm.php....

I've managed to get the login info, and check whether or not the user is registered, with something like this:




        $sql = "SELECT * FROM users WHERE userName = '" . $user ."' AND
password = '" . $password . "'";
        $result = mysql_query($sql, $db);

        if($myRow = mysql_fetch_array($result))
                echo "User not registered";

Where connect.php is the database connection.......... the thing is that once the user has been validated, I'd like to load welcome.php in the whole page, not just the iframe where the validation has been done.

Is there a way to do that? I tried something like :


        if($myRow = mysql_fetch_array($result))
                        echo "<script language=JavaScript1.1>
parent.load(/registro.php); </script>";

But the parent.load won't work :( any ideas?


keefaz 03-14-2005 07:02 PM

Did you put a session_start(); at the top of your php code
In the main page, not in frames, session has to be started
before any output to browser

poeta_boy 03-14-2005 10:35 PM

thanks a lot, but the thing is that I'd like to load a whole new page, being triggered by an even in the iframe..... is that possible?

thanks :)

keefaz 03-15-2005 03:45 AM

I don't know your complete code, but try :
PHP Code:

if(($myRow mysql_fetch_array($result)) !== FALSE) {
$_SESSION["user"] = $user;
"<script language=\"JavaScript1.1\"> parent.location.replace(\"/registro.php\"); </script>";

All times are GMT -5. The time now is 06:12 AM.