Php and html frames


#1

Hello.
I am a newbee in php. What I am doing some testing on now is the following scenario>

  • I have a html page composed of 3 frames
  • on frame 2 I have a button. When I press it, I want to display a resut on frame 3. A text of to call a function which does something and displys the resut on frame 3.

How do I target frame3 in this case?

Best regards!


#2

why on earth are you trying to use frames?


#3

Hi.
I am just exploring the possibilities. To see how it would look better.
:slight_smile:


#4

frames should be avoided at all costs, it’s simply not the way things are done in modern web design.


#5

I get it. Thanks!
:slight_smile:
Would it be possible for you provide an answer to my question?


#6

No more frames. Case closed.


#7

Just use CSS or if needed, use JQuery/Ajax to hide and show sections. Frames are not secure and as @chenks mentioned are not used nowadays. With CSS you can hide/show sections. With JQuery/Ajax you can load external PHP files into any place your file wherever you wish.

I guess the question is what are you loading into the sections? Just text, HTML code, or data from a database?

There are hundreds of ways to accomplish this with very little code. The issue is what is your functions going to do? If is just text from a result of a function, you can just use CSS or Jquery to place the code in the

of the display area. Give us a little more info on what goes there and show us your test code and we can help solve it…

#8

Hello.
I run a query towards a database, pressing the button on frame2 and using the result, I want to populate a list on fram 3.
:slight_smile:


#9

Well, one simple way is to just use Jquery and AJAX. You lock the button to a load function. The load function loads an external PHP file which would be the query and stores the results in the DIV you pick for the results.

In Jquery, you just use something like: $(“buttonName”).click(function() to attach it to a button.
You can also attach the loading of an external file loosely something like this:
$(“buttonName”).click(function(){
$("#div1").load(“get_data.php”, function(responseTxt, statusTxt, xhr)

In the PHP file you would place your query to acquire the data and format the output of the query.
That way, when you press the button, it loads an external file into the DIV of your choice.

In CSS, you can have the data already loaded into a DIV and hide them and use CSS to show them when the button is pressed.

Or, you could make the page into a form and have it post back to itself and dynamically rebuild the

using parms passed back to the page. Pressing a button would call the page (itself) with an argument passed and retrieved using $_GET variables. Simpler to just use the JQuery/AJAX way, or CSS…

Lots of ways to handle this. Good luck!


#10

Friends don’t let friends use frames. Frames went out about 50 years ago.


#11

Hee! Funny! (And, so true!)


#12

I am not going to use frames.
:slight_smile:


#13

Well, the two choices are either have the page run the query from another file using JQuery and AJAX or just have the page re-post itself using a form and alter the displays depending on the options selected.
I feel you should just use the form version as it is the easiest to learn how to do. By the way, you should use DIV’s instead of frames. DIV are basically like a frame. You use CSS to place them where you want on the page and fill them with your data as needed. Should work well for you and easy to learn about them.

Once you get your page started, let us know and we will help you with it.