Re: how to avoid executing whole script

From: Date: Sat, 20 Apr 2002 21:09:16 +0000
Subject: Re: how to avoid executing whole script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-93840@lists.php.net to get a copy of this message
At 20.04.2002 15:06, you wrote:
Hi, I'm new to php, I want to do the foll: in my code: display an array of names to the user, up, down, top and bottom buttons are provided so that the user can change the order of the names (e.g. if original array: "a, b, c, d, e and user selects e and presses top array should become e, a, b..... I am able to achieve this functionality however since the whole script is executed each time the array gets redefined after each button press thus it remains a, b, c,d ... Finally I've a submit button, if this is pressed user should be able to go back and do whatever he was doing with the names. my code looks like this: define array html for presentation (form which goes to function changelayerorder()) function changelayerorder (this func. detects which button and name was selected and changes order) I tried a while loop (while submit button not pressed) {do ...} but it results in the page never being able to load. CAN ANYONE ADVISE ME HOW TO AVOID REDEFINING THE ARRAY. THANKS, -Pushkar S. Pradhan Just think, you send the page to the clients browser, you (PHP) don´t have control
what happens on the clients side! Maybe you can split the functionality in separate, so if the client sends some vars, only a part depending on if, else or switch is done by php. Or (as last option) use JavaScript, which is client side but not always available. Best is to redesign your software, pages to avoid such conflicts. And, if you want to include all users just use html-code wich will work on most browsers. HTH Oliver

« previous php.general (#93840) next »