Close

Results 1 to 2 of 2
  1. #1
    DF VIP Member devs's Avatar
    Join Date
    Jul 2001
    Location
    uk
    Posts
    1,167
    Thanks
    54
    Thanked:        7
    Karma Level
    336

    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 VIP Member graham.edmon's Avatar
    Join Date
    May 2001
    Location
    Edinburgh
    Posts
    263
    Thanks
    0
    Thanked:        0
    Karma Level
    289

    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: www.myredirect.co.uk";

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

Similar Threads

  1. Replies: 0
    Last Post: 6th January 2003, 11:56 PM
  2. where can you buy swords form the uk online?
    By arv2k in forum Home Audio/Video, Electronic Toys & Gadgets
    Replies: 4
    Last Post: 1st October 2002, 04:24 PM
  3. 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
  •