Close

Results 1 to 2 of 2
  1. #1
    DF Jedi devs's Avatar
    Join Date
    Jul 2001
    Location
    uk
    Posts
    1,105
    Thanks
    46
    Thanked:        3
    Karma Level
    247

    Redirecting a CGI form? How!

    Hi people I've got a problem at work that I need to get sorted ;( I need to redirect a form on a HTML page, I've tried the…

    PHP Code:
    <input type="hidden" name="redirect2" value="mypage.html"
    The form is calling to a cgi script…

    PHP Code:
    <form action="mypage.cgi?tasks" method="post" name="_form" onsubmit="return staffSelect(this)"
    How can I stop the form from redirecting on Submit to the default area?

    Any help welcome!

    Cheers,
    Last edited by graham.edmon; 2nd September 2002 at 05:26 PM.

  2. #2
    DF PiMP graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    263
    Thanks
    0
    Thanked:        0
    Karma Level
    200

    Default

    PHP Code:
    #!/usr/bin/perl

    require './cookie-lib.pl';

    my %PARAMS;
    my $redirectto='';

    getPost(\%PARAMS);

    print 
    "Content-type: text/html\n";

    my $return_url $PARAMS{'redirectto'};

    print 
    "\n";
    print <<
    __REDIRECT__;
        <
    html>
        <
    head>
            <
    META http-equiv="REFRESH" content="0; url=$redirectto"
        </
    head>
        <
    body>
            <
    h3>Please wait.. Redirecting..</h3>
        </
    body>
        </
    html>
    __REDIRECT__


      sub ParseValue 
    # {the value}
         
    {
        
    my $value shift;

        
    $value =~ tr/+/ /;
        
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C"hex($1))/eg;
        
    $value =~ s/~!/ ~!/g;

        
    $value;
         }
     
         
    sub getPost # ($PARAMSRef)
         
    {
        
    # Get the input
        
    my $buffer "";
        
    my $PARAMSRef shift;
            
        
    read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
        @
    pairs=split(/&/,$buffer);

        
    #put everything into name/value pairs and store in LOGIN
        
    foreach $pair (@pairs) {
           (
    $name$value) = split(/=/, $pair);
        
                 
    $name ParseValue($name);
                 if (
    $PARAMSRef->{$namene '') {                 
                     
    $PARAMSRef->{$name} = $PARAMSRef->{$name} . '|' ParseValue($value);
                 }
                 else {    
                
    $PARAMSRef->{$name} = ParseValue($value);
                 }
        }
         } 
    example above, this will actually perform a redirect on the client side when the page has been returned, you can also do it thus..

    print "Location: [Only registered and activated users can see links. ]";

    Is this what you are meaning, you will obviously have to store/forward the contents of the form ...

Similar Threads

  1. one to one form...
    By LiquidJay in forum Job Centre
    Replies: 3
    Last Post: 8th December 2007, 06:14 AM
  2. Form help
    By abrocky in forum Website Coding & Graphics
    Replies: 1
    Last Post: 2nd March 2005, 11:07 AM
  3. Redirecting my website?
    By computerman in forum Web Hosting & Domain Names
    Replies: 2
    Last Post: 18th April 2003, 02:42 PM
  4. form z for mac
    By joeninety0 in forum PC Software
    Replies: 1
    Last Post: 6th February 2003, 09:33 PM
  5. Redirecting a CGI form? How!
    By devs in forum Web Hosting & Domain Names
    Replies: 2
    Last Post: 26th September 2002, 02:22 PM

Social Networking Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •