473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

To make multiple pages in the same page

Hi

I have 3 PHP pages with different names for a common survey. the first page has 8 questions next page the next 8 and so on. I have coded the three pages as separate PHP pages with names survey, survey1,survey2. what i want is make a single php file say survey which contains all info. So when i press submit the after 8 questions it should redirect to survey itself and survey should understand that next set of questions need to shown now. How can i do this?? I know its possible. I dont know how i can declare a variable and check its value. after each submit. Please let me know if i can use my same code and continue some how. Thanks for the help.
Mar 24 '08 #1
8 2524
TheServant
1,168 Expert 1GB
You haven't explained yourself clearly as I am still unsure after a couple reads. If you want to pass variables from one page to another, use sessions or hidden inputs. But your comment about declaring variables and checking its value makes me curious... How much experience have you had with php?

Anyway, post any code you have and maybe provide a little more clear an explanation.
Mar 24 '08 #2
ronverdonk
4,258 Expert 4TB
And do not forget to show any code within the apppropriate code tags!
See How to Ask a Question

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

moderator
Mar 24 '08 #3
Xean45
5
Personally, I'd use a cookie to pass the choices entered to the next pages. This would be the simplest approach, in my opinion. Or you could also write the selections to a temporary text file, but that would be more work than it's worth. Cookies I'd say.

~Xean
Mar 25 '08 #4
ronverdonk
4,258 Expert 4TB
I second what was previously said about using the session array. Because using the $_SESSION array is the simplest and easiest way to preserve and pass data around different pages/scripts.

Ronald
Mar 25 '08 #5
I am sorry for not being clear. let me try and explain again
1) I have a questionnaire which has three pHP pages survey, Survey1, survey2
2) each php has 8 questions.
3) now what i want to do is instead of having 3 php pages have a single page say new_survey. But at one time it should display only 8 questions. then when i continue to next page i use session variables to store the data that has been entered which is mentioned in survey1.
4) but now since i have only 1 page how do i direct it to the second part of the code which corresponds to survey1??

I hope i am being more clear now. I have to combine all 3 php pages into a single php page which works the sameway as i have been doing till now.

Can some1 help?? and by the way i am almost a fresher to PHP.

Thanks!!!
Mar 25 '08 #6
TheServant
1,168 Expert 1GB
How about using javascript to hide and unhide each block? That way, no page turning is needed but rather, when a user has finished the first 8, he clicks continue which will hide the first 8 and unhide the second 8 etc..
Mar 25 '08 #7
How can i restrict a piece of HTML code to execute using JavaScript. I am not being able to do that. and also how do i use javascript variable here...since after pressing the continue button wouldnt the value of that variable change to its original value?
Mar 26 '08 #8
I don't know if this will help, but i just did the same thing for a customer/user update page that has a lot of forms to be filled out in ASP.

I used 2 pages-- header.asp and usreinfo.asp

In the header i used tabs to go to and fro each page, but you prbly don't need that so just look at the exanple below

To make the explanation simple: use the query sting to move between the pages

www.whatever.com?page="1"

In the HTML I used the IF THEN ELSEIF statements to show the sections of forms i wanted displayed. (Like this)

Expand|Select|Wrap|Line Numbers
  1. <form  (do information)>
  2. <table>
  3. <% if request.QueryString("page") = "" then%> <!-- first page -->
  4.   <tr>
  5.     <td width="205"><div align="right">First Name</div></td>
  6.     <td width="10">&nbsp;</td>
  7.     <td width="221"><input  type="text" name="F_name" id="F_name" value="<%= userRS.fields("form") %> " />
  8.     </td>
  9.   </tr>
  10.   <% elseif request.QueryString("page") = "nextpage" then%> <!-- Page the next -->
  11.   (Step and repeat just remember to change your "page= 'variable' ")
  12.  
  13. <%end if%>
  14. </table>
  15. <Button>
  16. </form>
  17.  
  18.  
To submit the form use the same method the the head section only submitting the form fields for that page in the query string. You can also use it with the Java validation scripts to make sure they submit information correctly.

I hope this helps out. I know it is not PHP but might give you a step in the right direction. Of course i am learning as I go and consider myself a novice, so I am sure someone has a quicker way and the correct method for PHP.

Jason
Printedgoods.com
Mar 28 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: noah | last post by:
Does PHP have a feature to associate Cookie sessions with a persistent database connection that will allow a single transaction across multiple HTTP requests? Here is how I imagine my process: I...
11
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
3
by: Damon | last post by:
I am working on a site in which I would like to have two dropdowns that will allow a user to navigate through the administrative pages of the site. The first would allow the user to choose the...
9
by: Graham | last post by:
I have been having some fun learning and using the new Controls and methods in .Net 2.0 which will make my life in the future easier and faster. Specifically the new databinding practises and...
2
by: ray well | last post by:
hi, i need to print multiple pages on a printer. this is what i'm using now Sub Print() Dim PrintDoc As New PrintDocument AddHandler PrintDoc.PrintPage, AddressOf Me.PrintText Do While...
3
by: Bart Van der Donck | last post by:
Hello, I'm having a hard time trying to configure printed output that consists of multiple pages. The idea is the following: <div style=" border: 1px solid blue; position: absolute; top:...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
4
by: Greg | last post by:
I have a complex page (with 8 complex user controls, and many other asp.net controls.) I have 2 very similiar pages to create, each page differing only from the others in one control. What is...
1
by: assgar | last post by:
Hi I was using a schroll bar to display multiple rows of dynamically created from database records. The scrolling was not displaying the data properly so I have decided to use pagination. The...
6
by: Homer J. Simpson | last post by:
Hi all, I have enough experience with HTML/classic ASP to get by, and I'm trying to learn ASP.NET. Traditionally, I've taken the habit of breaking out extra-long CSS files into multiple,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.