-2

pastebin of the php script:

http://pastebin.com/b43cZjLQ

// Form success
        // Remove the form element form the dom
        if($form_success){

            // Hide the form
            $form = $dom->getElementsByTagName('form')->item(0); 
            $form->setAttribute("style", "display: none");

            // Callbacks
            foreach($this->_callbacks as $data){
                if(is_callable($data['callback'])){
                    $result = call_user_func($data['callback'], $_POST, $data['config']);
                    $hide_id = $result ? self::ERROR_MESSAGE_ID : self::SUCCESS_MESSAGE_ID;
                    $this->hideIdElement($dom, $hide_id);   
                }else{
                    trigger_error( "Form handler is not callable", E_USER_ERROR);
                }
            }

        }

    }else{
        $this->hideIdElement($dom, self::SUCCESS_MESSAGE_ID);
        $this->hideIdElement($dom, self::ERROR_MESSAGE_ID);     
    }

    return str_replace(array(   '<?xml version="1.0" standalone="yes"?>', 
                                '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">',
                                '<html><body>', 
                                '</body></html>'), '',$dom->saveHTML());

}

What I'd like to do with this script is redirect to page (success.html)on success of form submission.

I am pretty new to PHP and would appreciate any help you could offer.

Thank you for taking the time to look at this, it's greatly appreciated.

EDIT: LOL Sorry for the first GIANT CODE DUMP! Fixed.

hakre
  • 193,403
  • 52
  • 435
  • 836
wilwaldon
  • 381
  • 1
  • 9
  • 26
  • 1
    holy lol that's alot of code...! For redirect use `header()` http://php.net/manual/en/function.header.php – KJYe.Name Apr 04 '11 at 18:26
  • 1
    Hire a professional to do the job, if you're just gonna dump a lot of code and have us figure it out. I mean, if you knew a little bit about the subject, you'd probably have narrowed the code down to the significant parts. – Decent Dabbler Apr 04 '11 at 18:29
  • Sorry about the code dump, totally wasn't paying attention to what I selected haha. Fixed it up and pasted the good parts. – wilwaldon Apr 04 '11 at 18:35
  • possible duplicate of [How to make a redirect in PHP?](http://stackoverflow.com/questions/768431/how-to-make-a-redirect-in-php) – hakre Dec 10 '12 at 04:06

3 Answers3

1
echo "<script>location.href='success.html';</script>"; 

:)

Xavian Tracy
  • 127
  • 1
  • 10
1

Try

if( !empty( $_POST ) ) {
    header( "Location: success.html" ) ; exit ;
}

And yeah, it's a bit too much code to read, just show the part where your post action is directed to

kos
  • 478
  • 2
  • 10
1

Using the function header, you can redirect the user to any other page.

Example:

header('location:success.html');
die();

Docs: http://php.net/manual/en/function.header.php

A common "gotchya" with header - be sure that no other portion of your script has had any output. Any echo or print statement, or any error output (notices, warnings, etc) can cause your header statement to fail.

Chris Baker
  • 49,926
  • 12
  • 96
  • 115
  • Thanks Chris! I'm having trouble finding where I should put that code. Any chance you could point me in the right direction? I am trying to learn by doing this but some times I need a helping hand. – wilwaldon Apr 04 '11 at 20:04