Load a page dynamically
Moderator: General Moderators
-
asif_phpdn
- Forum Commoner
- Posts: 28
- Joined: Sun Aug 26, 2007 8:50 pm
Load a page dynamically
I want to load a page dynamically after click the next button. How can I do that? Any help 
I think there are more than a solution...
One possiblity is that when you click the button you always call the same page with a parameter that tell which page you want to call and in this page you put a redirect line.
Supposing you pass the parameter "page_name" with the GET method, in the called page you will have something like this:
Another possibility is to manage the click button with a javascript function that load the page depending a parameter. In this case, an example can be:
and in the form the button that call this funtion is something like this code:
I hope you understand me...I don't speak english very well...
One possiblity is that when you click the button you always call the same page with a parameter that tell which page you want to call and in this page you put a redirect line.
Supposing you pass the parameter "page_name" with the GET method, in the called page you will have something like this:
Code: Select all
header("location: ".$_GET['page_name']);Code: Select all
function load_page(page_name)
{
document.location.href=page_name;
}Code: Select all
<input type="button" id="btn_load" onclick="load_page('page_name');">-
asif_phpdn
- Forum Commoner
- Posts: 28
- Joined: Sun Aug 26, 2007 8:50 pm
Thanks luna80 for your help. But.....luna80 wrote:I think there are more than a solution...
One possiblity is that when you click the button you always call the same page with a parameter that tell which page you want to call and in this page you put a redirect line.
Supposing you pass the parameter "page_name" with the GET method, in the called page you will have something like this:
Another possibility is to manage the click button with a javascript function that load the page depending a parameter. In this case, an example can be:Code: Select all
header("location: ".$_GET['page_name']);
and in the form the button that call this funtion is something like this code:Code: Select all
function load_page(page_name) { document.location.href=page_name; }I hope you understand me...I don't speak english very well...Code: Select all
<input type="button" id="btn_load" onclick="load_page('page_name');">
Do you mean include a file or page in your first point???
Anyway I think your third point is easy for me.
My mother language is not English.
So I'm what you are.
no...asif_phpdn wrote:
Thanks luna80 for your help. But.....
Do you mean include a file or page in your first point???
in the action of the button's form you put a page, in this page you put the code I show you in my first response. I show you the complete code:
example for the page with the button:
Code: Select all
<form id="form1" method="post" action="page.php">
<input type="text" id="page_to_load">
<input type="submit" id="btn" value="load page">
</form>Code: Select all
header("location: ".$_POST["page_to_load"]);I hope this example help you to better understand
-
asif_phpdn
- Forum Commoner
- Posts: 28
- Joined: Sun Aug 26, 2007 8:50 pm