Hello, im new here

Ive got a bit of a problem, I have set my website into a layout which is made from php, it has a header, menuright, menuleft, content and footer pages which are linked together using my index.php page. Basically I have a search form in my left menu page, and I want the results to appear in the content part of my page (page2.php)

The search function is working correctly but im trying to put my results onto the content page (page2.php), so I thought this code at the top of my form would work:

<form name="search" method="post" action="page2.php">

But this takes puts the page2.php page into a new page, instead of inserting the results into the page2.php on my main page.

here is the link to my site

Hope this makes sense and hopefully someone can help me.

Thanks,

    If I understand it correctly, you have a page, say index.php that uses different pages as includes to add menues, header and such, right?

    Don't target specific include, target the page where the results suppose to appear, i.e. index.php

    Now, you can add some logic to show results only after form is submitted, something like:

    if ($_POST['searchField']) {
       echo $searchResults;
    }else {
       echo $yourContent;
    }
    

    That logic could be on your page2.php page.

      Sounds like you're using frames. If so, you need to give the target frame a name. Then, when you write to your frameset, you can use "target='frame_name'" where frame_name is the name of your display frame.

      Hope this helps.

        jkurrle wrote:

        Sounds like you're using frames. If so, you need to give the target frame a name. Then, when you write to your frameset, you can use "target='frame_name'" where frame_name is the name of your display frame.

        Hope this helps.

        no im not using frames, basically I have five pages and the index.php links all together like so...

        <body>
        <div id="maincontainer">
        <div id="topsection"><?php include("http://www.indie-design.co.uk/topsection.html"); ?></div>
        <div id="contentwrapper"><?php include("http://www.indie-design.co.uk/page2.php"); ?></div>
        <div id="leftcolumn"><?php include("http://www.indie-design.co.uk/leftcolumn.html"); ?></div>
        <div id="rightcolumn"><?php include("http://www.indie-design.co.uk/rightcolumn.html"); ?></div>
        <div id="footer"><?php include("http://www.indie-design.co.uk/footer.html"); ?></div>
        </div>
        </body>

          All this code makes one page, regardless of the includes that are actually different pages. If you need to post search results on this page you actually need to put index.php in action and not any of the includes. Now, you can use some basic logic to replace any of the includes with another include that would have results but that's not what you're asking here.

          <body>
          <div id="maincontainer">
          <div id="topsection"><?php include("http://www.indie-design.co.uk/topsection.html"); ?></div>
          <div id="contentwrapper"><?php include("http://www.indie-design.co.uk/page2.php"); ?></div>
          <div id="leftcolumn"><?php include("http://www.indie-design.co.uk/leftcolumn.html"); ?></div>
          <div id="rightcolumn"><?php include("http://www.indie-design.co.uk/rightcolumn.html"); ?></div>
          <div id="footer"><?php include("http://www.indie-design.co.uk/footer.html"); ?></div>
          </div>
          </body>
          

          And you probably do not need to use absolute paths...

            yea I understand now and have got it working, thanks for all your help

              Write a Reply...