Hi..guys!I have several pages which supposed to execute in sequential order,reserve.php,reserve2.php,reserve3.php,...How could I resolve them in same address as reserve.php and execute in proper order?Thanks...
Printable View
Hi..guys!I have several pages which supposed to execute in sequential order,reserve.php,reserve2.php,reserve3.php,...How could I resolve them in same address as reserve.php and execute in proper order?Thanks...
Using includes probably or even a simple iframe.
Let said I have a button in first page to link to later pages
how can I use include() at here?Code:<input name="continue" type="button" id="continue4" value="Continue" onclick="window.location='reserve2.php'">
Simply continue to use that code to include the next page. I Personally think your best bet would actually be to use an iframe or just combine the other files into reserve.php.Code:if (isset($_POST['continue'])) {
include_once('reserve2.php');
}
Hope this helps.
Use a session.
<?php
session_start();
$_SESSION['n'] = @$_SESSION['n']+1;
include('reserve'.$_SESSION['n'].'.php');
?>
EDIT: posted at the same time. Either way could work. testingsite's option would give more control. Mine is simpler, if you really just want it to run a new page on each load, without any confirmation/control.
Actually I want it to be executed in proper order so user can't simply type reserve2.php,it must go through it from the first page,reserve.php
My code will do that, but start from reserve1.php.
Oh..Thanks..how to reset the "n",every time I open reserve.php,its value keep growing and said that warning that failed to include('reserven.php')
On the last page, you may want to unset the session like so:
Hope this helps.Code:unset($_SESSION['n']);
Let said I have 2 pages right now,reserve,reserve2.php,when session reset,why these 2 pages are combined into one page with first page topped by last page??
Not sure. Sounds like an error. Do you have an example?
No error shown.But first page is topped by second page.
Seond Page
http://img.photobucket.com/albums/v2...r/reserve2.jpg
First Page
http://img.photobucket.com/albums/v2...er/reserve.jpg
"Topped by"? I don't really understand what you mean.
However, you may want to use another method entirely.
The methods we posted were designed to simply display pages, not interact.
With forms like that, you should have a much more specific system setup to send the data from one to the next.
Something more like what testingsite posted in the first place would make sense here.
if (isset($_POST['myvariable'])), then you would know that the form has been submitted and you should display the next page.
Sorry.I mean topping,the second page appear on top of first page,I am thinking to use session to control all pages shared the same address(reserve.php) and the value selected in drop down menu and radio button also have further processing,like store into database.So is it session much better than include()?
session and include are both used, for different reasons.
I'd suggest taking a step back and figuring out exactly what you want.
It seems to me that you want a site that will start on a certain page, then submit to a second page, then a third, etc.
As I said, the options we've given you so far just display the next page, and they don't relate to actual data submission.
With a system in which you have forms that matter, you will want error checking as well.
Having two pages would make a lot more sense than combining them into one, especially if this isn't an area of coding you have a lot of experience.
It IS possible to make them all be one page, but I would suggest a different approach in that case, using get variables (page.php?variable=value) to set which page you're using. You could do the same, though it would take a bit more work to get it to know which page should be used. In that case, you should check which post variables have been set.
Ya.I want the data pass through several pages,any method for data submission?For now I don't understand that why pages are combined after I reset session.
Have the form on a single page then submit to another page (action="next.php"). That next page can interpret the data.
I like this tutorial--
http://www.php-mysql-tutorial.com/ph...-php-forms.php
As for why there are two instances of the page, I have no idea. The code I gave should be on a page by itself, then grab the other pages. What you describe could be from having the code I gave you ON one of the pages, so it loops and does it twice. That's all I can think of, really.