[PHP] Re: Directing form to different handlers?
On Mon, 1 Jun 2009 12:53:31 +1000, angusm...@pobox.com ("Angus Mann") wrote: >Hi all. I realize this is more an HTML question than PHP but I'm sure someone >here can help. > >I have several forms with lots (dozens) of text inputs. If the user presses >the "Update" button I want the form handled by "update.php" but if they press >"Delete" it needs to be handled by "delete.php" or "add.php" and so-on >depending on the button they press. > >But when establishing the form I can only have action="delete.php"> or "add.php" or whatever. > >Is there a way to direct the content of the form do a different handler >depending on the button? > >I know I can use javascript to direct to a constructed URL and append >?name=smith&address=hishouse&telephone=28376.and so on but this is not >practical when there are dozens of entriesthe URL becomes massive. I >prefer to use "POST" and then use PHP to extract the POST array. > >Any ideas? I have two ways of handling this type of menu. In the first I have a form with a 'submit' button, containing a number of radio buttons specifying different actions: /> Select names The form can also contain check buttons specifying auxiliary options and text boxes specifying input quantities. My second type of menu looks very similar, but there is no form, and each option is a small image (usually a yellow diamond). When you hit any button it invokes a new page passing the new action, and related quantities, as parameters: echo''; echo ' Edit album page'; The same response handler handles both types of menu. It first looks for 'action' in $_GET, then it looks in $_POST, then it loads the appropriate handler as described below. My standard program operates in four steps: 1. It checks for responses from the preceding page 2. It processes them. To do this it has a table of response handlers, and includes a file which handles the responses from the previous action. 3. It reads the new action, and includes the handler for this from a table of action handlers. Quite often this is another menu which enables the user to specify additional information. It is usually (but not necessarily) included inside the form for the main menu, so that the specific fields appear above the normal foot. 4. Finally it offers the same, or a different, menu for the user to specify the next action. The advantage of the first type of menu is that it permits you to specify several different values at the same time. For example one menu has a text input in which you can enter a search string and different action buttons enabling you to specify to search surnames only, search any name, or search in all possible fields. Its disadvantage is that you have to select an action, then hit the submit button. The advantage of the second type is that you only have to click one button, and it's disadvantages are that you cannot specify auxiliary quantities, and you don't get a second chance. Because the program is broken up in this way it is extremely flexible, and can completely change its appearance and behaviour according to the task it is carrying out. The whole program has a massive amount of code, but most of this is in the action and response handlers, and because these are only included when they are needed, only a relatively small amount of code is in memory at any given time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re-directing
Awesome! Learn something new everyday! That's why I love this list :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> "Chris Sharkey" <[EMAIL PROTECTED]> 07/24/02 11:01AM >>> Well you can actually, If you start your script IMMEDIATELY (well before you output anything) with: To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, July 25, 2002 12:47 AM Subject: Re: [PHP] Re-directing PHP redirects using the header() function, but it's not very useful if information has already been sent to the browser. ANY information, including a hard return. So if you have a login script, you would start your session, register any variables, then redirect. That would do the trick. But like I said, once the parser begins to write HTML to the browser, then you can no longer send HTTP headers. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> "Roberts, Mark" <[EMAIL PROTECTED]> 07/24/02 10:28AM >>> Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re-directing
Well you can actually, If you start your script IMMEDIATELY (well before you output anything) with: To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, July 25, 2002 12:47 AM Subject: Re: [PHP] Re-directing PHP redirects using the header() function, but it's not very useful if information has already been sent to the browser. ANY information, including a hard return. So if you have a login script, you would start your session, register any variables, then redirect. That would do the trick. But like I said, once the parser begins to write HTML to the browser, then you can no longer send HTTP headers. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> "Roberts, Mark" <[EMAIL PROTECTED]> 07/24/02 10:28AM >>> Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re-directing
PHP redirects using the header() function, but it's not very useful if information has already been sent to the browser. ANY information, including a hard return. So if you have a login script, you would start your session, register any variables, then redirect. That would do the trick. But like I said, once the parser begins to write HTML to the browser, then you can no longer send HTTP headers. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> "Roberts, Mark" <[EMAIL PROTECTED]> 07/24/02 10:28AM >>> Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re-directing
Use header() function.. Header('Location: script name'); Best Regards Balaji -Original Message- From: Roberts, Mark [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 7:58 PM To: PHP Mailing list (E-mail) Subject: [PHP] Re-directing Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED] **Disclaimer Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re-directing
Check under header() in the docs... .: B i g D o g :. - Original Message - From: "Roberts, Mark" <[EMAIL PROTECTED]> To: "PHP Mailing list (E-mail)" <[EMAIL PROTECTED]> Sent: Wednesday, July 24, 2002 8:28 AM Subject: [PHP] Re-directing > Is there a way to redirect to a different script in PHP? I call it > redirecting, but can't find it in the documentation using that track. > > I have a script...that if a certain criteria is met, I want to load a > different script. Haven't been able to figure that out yet. I have gotten > about it by conditionally executing a location.href in javascript. It works, > but would like to know how to do it in PHP. > > ~Thanks. > > Mark Roberts > Sr. Systems Analyst > LanApps/Web Development > The Williams Information Services Corporation > 918-573-1706 > [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re-directing
Is there a way to redirect to a different script in PHP? I call it redirecting, but can't find it in the documentation using that track. I have a script...that if a certain criteria is met, I want to load a different script. Haven't been able to figure that out yet. I have gotten about it by conditionally executing a location.href in javascript. It works, but would like to know how to do it in PHP. ~Thanks. Mark Roberts Sr. Systems Analyst LanApps/Web Development The Williams Information Services Corporation 918-573-1706 [EMAIL PROTECTED]
RE: [PHP] Re-directing
ohhh... i thought he wanted to know how to do a simple redirect... not how to make 'start.php' the index... i agree it's an odd request. why not just name it 'index.php', or specify 'start.php' with apache? > -Original Message- > From: B. van Ouwerkerk [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, May 16, 2001 4:58 PM > To: scott [gts] > Subject: RE: [PHP] Re-directing > > > At 14:56 16-5-01 -0400, you wrote: > >if you need to redirect a page, why not juse use > >header("Location: ./newurl.php"); ?? > > > >or, as was suggested, use the apache directive > >to do it for you if you have access to the > >config files... :) > > Nope. .htaccess can contain almost any directive which is found in the > httpd.conf file. It will even work with most ISP's :-) > > Meta refresh is a good idea too.. But I would consider javascript one of > the worst things possible. In my experience it's buggy and you need the > visitor to be so kind to enable javascript.. > > I wonder why the person who asked the question in the first place just > doesn't want to call his start.php (or whatever de name is) index.php .. oh > well probably a M$ lover. > > Bye, > > > B. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re-directing
> >If you're hosting on a apache box you could have something like > >DirectoryIndex start.php Forgot to mention: You can add this to .htaccess Bye, B. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re-directing
>I use a little bit of javascript ... > > > location = "newURL.php"; > > >inside the tags. ouch. Say I've got javescript disabled.. what happens.. exactly.. nothing. I hate clientside cause I can't control it. If you're hosting on a apache box you could have something like DirectoryIndex start.php Should run fine. Have fun. B. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re-directing
Todd Cary wrote: > > In my Index.html, what do I write so that the Surfer goes to my > Start.Php? > > Todd I use a little bit of javascript ... location = "newURL.php"; inside the tags. -- Raquel If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music which he hears, however measured or far away. --Henry David Thoreau -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re-directing
Todd Cary wrote: > In my Index.html, what do I write so that the Surfer goes to my > Start.Php? It should work to have this after your opening HTML tag in index.html: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re-directing
In my Index.html, what do I write so that the Surfer goes to my Start.Php? Todd -- Todd Cary Ariste Software [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]