alapidus
Jan 18 2005, 10:32 PM
| | let's say that for whatever reason, let's say for a survey, i want to make a quiz like w3schools.com has, only with PHP. i would want to put all the questions on different pages, also like w3schools.
could each of the submissions stay stored inside PHP's $_POST for 20 pages? if not, how could i get around it?
PS. i really don't know anything about ASP other than the fact that w3schools uses it. so please don't explain to me with ASP-specific terms... |
Reply
Mike
Jan 21 2005, 07:56 PM
Take a look at the 'cool' quiz that I created a few days ago. Sub-Zero :: Cool Quiz Do you mean a quiz like that? However, once you leave the results page; when you come back your results are not there anymore! I think this may the thing you are asking about. If you want your results to stay saved, I believe that you should make a database table for the quiz. Then you could use a simple MySQL query to insert the results in the database table. If you make the table, I could give you the query. P.S. www.w3schools.com is coded in ASP. :-)
Reply
LuciferStar
Jan 22 2005, 06:13 AM
you may try to save the last_page_post_data into new page,using <input type=hidden name=hidden_last_page_data value=last_page_post_data> this tag may be invisible.
Reply
alapidus
Jan 23 2005, 01:24 AM
QUOTE(Mike @ Jan 21 2005, 02:56 PM) Take a look at the 'cool' quiz that I created a few days ago. Sub-Zero :: Cool Quiz Do you mean a quiz like that? However, once you leave the results page; when you come back your results are not there anymore! I think this may the thing you are asking about. If you want your results to stay saved, I believe that you should make a database table for the quiz. Then you could use a simple MySQL query to insert the results in the database table. If you make the table, I could give you the query. P.S. www.w3schools.com is coded in ASP. :-) yeah, but if i were to use a database. i would have to automatically delete the results when they finish the test. then the database storage space and server speed would become inconsistent and too dependent on the quiz page...
Reply
stevey
Jan 31 2005, 10:31 AM
The best way to store the data is just like lucifer star said, and this is the most widely used, pass the variables over to the next page and store them there with hidden values,eg. of code CODE <?php //if the previous post variable is $_POST['name']; //then in the next page after the form is submited do this echo"<input type=\"hidden\" name=\"question1\" value=\"".$_POST['name']."\">"; ?>
or alternatively a database like aproach. store the answers of every page to a text file in the windows temporary directory ,then after calculating the results just delete the file after wards and well if you dont delete it windows will, when you reboot the system or the best alternative and i would recomend this. is use php sessions every time the form is submited on the next page register the session varible with the value of the form, if you need code for that jus let me know
Reply
FaLgoR
Jan 31 2005, 04:50 PM
QUOTE(alapidus @ Jan 18 2005, 07:32 PM) let's say that for whatever reason, let's say for a survey, i want to make a quiz like w3schools.com has, only with PHP. i would want to put all the questions on different pages, also like w3schools. could each of the submissions stay stored inside PHP's $_POST for 20 pages? if not, how could i get around it? PS. i really don't know anything about ASP other than the fact that w3schools uses it. so please don't explain to me with ASP-specific terms... use hidden inputs.. <input type="hidden" name="lastquestion" value="$nameofthelastinput"> Put load of this in all pages, and you will save all them, simple, huh? ;D by the way, you don't need to use $_POST["varname"], you can simply use $varname only, if register_globals is turned on (in trap17 it is).
Reply
stevey
Feb 1 2005, 12:23 AM
well its always good to be on the safe side so thats why in my scripts i always use $username = $_POST['username']; its just a habit lol.
Reply
Similar Topics
Keywords : long, post, variables, stay, stored
- Counting Variables?
(4)
Php Sessions And Post Variables Issues
My script dosent seem to work as intended (1) You can test it out for yourself at http://sonesay.trap17.com/application.php I've been
working on this page locally and it seems to be working fine but when I upload it to my trap17
account the post variables dont get saved properly. Fill in some fields and submit it, the form
will come up as a empty field yet when you resubmit it without any modifications and the data you
entered in orginally will now magically appear, resubmit it again and it will be gone. This is
really annoying as I have no clue why it would be doing this when it seems to work fine locally.....
Sending $_get[] Variables To An Application
(3) I'm trying to work out if it is possible to send variables to a application on server. E.g
send the variable of id which is equal to 10 to an application - test.exe?id=10 Any ideas to see if
this is possible?....
How Do I Pass Php Variables From A Url To A Form?
I'm about read to tear my hair out with this one (5) Ok, what I need is for users to be able to select what address they want (e.g. mydomain + .com),
click submit that then sends the variables 'domain' and 'ext' through the URL e.g.
mywebsite.com/example.php?domain=mydomain&ext=com (the variables being mydomain and com) where they
are displayed in a form mail as "Domain Selected: mydomain.com" that can then be submitted and sent
to an email. In my form so far I have CODE <input name="domainname"
type="text" id="domainname" value ="<?php echo "$domain"; ?....
Storing Session Variables Generated Dynamically
(3) i have many pool (quiz) modules on my site with the information taken from a database. The modules
are processed by the same function with different parameters and i need to save the pool's
status to prevent a user vote several times. I do this setting $_SESSION to 1 , variable
being the name of the quiz, which is taken from the database. So i get to having a code like this:
.................... $name= $row->quiz_name; $_SESSION =1 The problem is that if
i call $_SESSION from another part of the site (another page) the variable is al....
Session Variables
Sessions in PHP behaving strangely (4) Hi. I am part of a development team working in PHP and MySQL. The site is using SSL, and users
have to log to use the site. When users log in, their important details are retrieved from the
database and stored in session variables (functionality in the site is permissions specific).
Lately, sessions are "disappearing" for no apparent reason. Users will log in, and at some point
(the length of time will vary unpredicatably) the sessions will lose their value (the variables are
empty) and this causes the site to evict the user. This is very frustrating for the user b....
Converting Characters In A Variable To Individual Values In An Array
turning variables into arrays (2) Say I have a variable such as $nav_item and it had to contents Home . IE: CODE
$nav_item = 'Home'; How would I make so that $nav_item was an array and
had the following contents? CODE $nav_item = array ('h', 'o',
'm', 'e'); With the case changing (ie H would become h and U
would become u ) EDIT: Okay found out that I could change the case with
array_change_key_case ($nav_item, CASE_LOWER); ....
Transfer Variables To Another Php Script
(8) Hello, I've one registration page where the users fills in their information, is it possible to
trasnfer the things the fill in on the registration page to another script that does someting and
returnes something to the first page like true/false and then the registration gives an error
messange if the other php script returned false? Something like the script "activates" another
script that does something and returnes the result back to the original script. Best Regards ....
Alternative To File()?
file stored in arrays (4) Hey guys. I was wondering if there is an alternative to using file(). I'm trying to read a file
and store it into an array without using the file function. Before, I was doing something like this:
CODE <?php $file = file("http://yahoo.com"); ?> Simple.
It gets the contents of index.html at yahoo.com and store each line in an array. Well, I was
wondering if there is another code that could do that without using the file function. Thanks for
helping!....
Stored Or Global Variable?
(1) I've created a form, nothing special, that uses a php script as a form action to input data into
mysql. Nothing special at all about this scenario. One thing I'd like to do is have the php
script redirect the user back to the html page that has the form the user just completed. I
don't want to have to hard code the url into the header function because I use this php script
with a bunch of other pages. Does PHP store the value of this page into some variable that the php
script can use? Thanks. kvarnerexpress....
Looking for long, post, variables, stay, stored
|
|
Searching Video's for long, post, variables, stay, stored
|
advertisement
|
|