SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: php and frames

  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    Queanbeyan
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php and frames

    Hi there,

    I am new to php and am having some problems with getting a script to work in a frames page.

    I have a simple script to send data to a mysql database. The script works fine if I load the page into a browser by itself. However, I want the page to be a seperate frame on a page.

    When I put the page into a framed html page and use it from there, it doesn't post the data on the first attempt. All it does is reload the frame (which it's supposed to do as well). if I retype in the data after the page is reloaded it works, and then works in every subsequent attempt (until I refresh the page). Here is the php code for the page:

    <?php
    MYSQL_CONNECT("localhost","root","password");
    mysql_select_db("chat");

    if(isset($_POST['submit'])) {
    $message = $_POST['message'];


    $sql = "INSERT INTO table SET
    message = '$message'";


    if (@mysql_query($sql)) {
    echo('<p>Data entered succesfully</p>');
    } else {
    echo('<p>sorry, but there was an error');
    }
    }
    ?>

    Has anyone experienced this problem and know how to fix it? I'd appreciate any advice.

    Wazza75

  2. #2
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you explain it a bit more please??

    also keep in mind when you do work in frames think of them as 2 different browser windows which has no relation to each other (well, you can use javascript to get around), so a file included in one frame is not available inother.

    i think i am not missing something
    hope this helps

  3. #3
    SitePoint Member
    Join Date
    Jan 2005
    Location
    Queanbeyan
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks form your reply, I figured it out, it was a dumb mistake. The page in the frame was called 'send.php'. Only when I first set the page up I mistakenly created a page called 'send.html', with the php code in that page. I thought I'd changed the file extension to go to the php page on the main frames page, but i had mistakenly changed another frame.

    The html page pointed to the php page, so of course all it would do is go to the php page, not process my script. I spent hours searching google for 'frames php' & 'frames forms' and the like while all the time it was a stupid little mistake stairing me in the face. Strange how that works.

    Anyway, thanks for your reply.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •