Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

77 users online



Multiple steps in one install script

Multiple steps in one install script

Currently viewing this thread: 1 (0 members and 1 guests)


Page 2 out of 2
O_ONanaki

O_ONanaki

I'm a screenwriter. What am I doing here?
Status: Offline!

Welll anyway, I'm thinking that the easiest thing to do is to not have the multiple steps thing. If I ask for everything needed for setup on one page then I'll save myself the trouble. I only wanted multiple steps so that if there was an error the user would know what went wrong and when exactly it happened.

Passing everything via POST seems kind of sloppy and a bit hack-ish so I'll just forget it altogether. Thanks for your help.

___________________

http://nhjm.net/~eleo/~temp/cheneyad2.gif
Dick Cheney Nude -- Sign the Petition!

phpmonkey

phpmonkey

whoa, wtf?
Status: Offline!
Quote:

Originally posted by O_ONanaki
Welll anyway, I'm thinking that the easiest thing to do is to not have the multiple steps thing. If I ask for everything needed for setup on one page then I'll save myself the trouble. I only wanted multiple steps so that if there was an error the user would know what went wrong and when exactly it happened.

Passing everything via POST seems kind of sloppy and a bit hack-ish so I'll just forget it altogether. Thanks for your help.

Well you have a few options to combat, pass them as <input type="hidden" name="name" value="value" /> , saving them as $_SESSION varibles or save them in some sort of cached, unaccessable file via serialize() those are my suggestions.

___________________

Fomerly known as lasnaranjas. Holler.
http://card.mygamercard.net/gelsig/blackdood.png

lucid

lucid

Status: Offline!

stateless, meaning the fundamental aspect of the web is that it does not retain any 'state' after serving your a page. after it sends you the data, it forgets everything about you/it. so to get around that we have things like forms, cookies, sessions, databases, etc. with which we can emulate 'state'

there's nothing hackish about using hidden fields and POST, or any of the other ways. you -have- to do some variation of those methods

if you really want to avoid it, you could do this -- at the beginning of each step (after step 1), process the POST form data from the previous step, then write it to the database immediately, instead of waiting till the very last step is completed to write to the database. if you do that, you don't have to use the same hidden fields over and over

it actually is a bit of a cleaner method now that I think about it, cuz you could 'restore' the installation at the point where it last ended, if the user doesn't want to/get a chance to totally finish the install in one sitting. you could store the last successfully completed step in the DB, then give the option to jump back to that point next time the user runs the install script

the only thign is it's hitting your DB server n times (for n steps) instead of just once at the very end of the setup process, but that's highly unlikely to be a big deal

Zeratul

Zeratul

kage
Status: Offline!

This is getting too complicated!
In order to achieve this, read the GPC/Variable Tutorial.
GPC stands for Get, Post, Cookie.

The Get is the one set in the URL.
Post, as in for forms.
Cookie, well, yummy... This is obvious.

In this case, you will use forms and the $_POST variable.
You need something like:

PHP:

<form action="<?php echo $PHP_SELF?>?a=2" method="post">
</form>

Now, you need a specific variable for each input tag or a form.

PHP:

<form action="<?php echo $PHP_SELF?>?a=2" method="post">
<input type="text" name="USERNAME" />
</form>

So, the form named USERNAME can be called as $_POST['USERNAME'], so that in the next page (self.php?a=2), the variable can be called, can be checked, can be anything. Just keep on passing and passing variables from one "section" to another.

EDIT:
I also recommend the "switch" function.

PHP:

<?php
switch ($_GET['a']) {
default:
// show 1st forms here...
break;
case 
'2':
// check if forms are filled correctly, if yes, display next set of forms....
break;
case 
'3':
// just like case '2'
break;
case 
'4':
// check, then finish!
break;
}
?>


It is much cleaner and more readable than if ($GET['']) statements.

I just hope that this helps you understand what you need to know.

Last edited by Zeratul, July 26th, 2004 12:38 AM (Edited 1 times)

Page 2 out of 2
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0179 seconds.