Results 1 to 6 of 6

Thread: Redirecting Problem Upon Form Submission...

  1. #1
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Redirecting Problem Upon Form Submission...

    Can anyone look at the code below and tell me why the Redirect to: '.../thank_you_for_your_submission.htm' doesn't launch upon submission. The data DOES get properly dispatched to the email address, yet I've failed time and time again to get the 'submission,htm' page to open. Do I need to have PHP-related code in place to tie in with my host's PHP service to make this work? Thank You in advance for any assistance you can give me.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>Form Mail</title>
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <FORM action="mailto:smitty@work.com?subject=EVENT FORM"
    method=POST encType=text/plain>
    <input type=hidden name="subject" value="Form Mail Results">
    <input type=hidden name="required" value="fullname,email">
    <input type=hidden name="redirect"
    value="http://www.companywebsite.com/submission_received.htm">
    Name<br><input type=text name="fullname"><br>
    Email<br> <input type=text name="email"><br>
    <br> Comments<br> <textarea name="comments"></textarea> <br>
    <br> <input type="submit" name="Submit" value="Submit">
    </form>
    </body>
    </html>

  2. #2
    Join Date
    Jul 2007
    Location
    Irmo, SC
    Posts
    96
    Thanks
    10
    Thanked 7 Times in 7 Posts

    Default

    I would create a PHP page to handle the email and redirect.

    Code:
    if ($_POST["send"]=='Y') {
     ...... build email based on text fields from POST VARS
    ..... use php mail function to send email
    header("Location: http://www.companywebsite.com/submission_received.htm");
    }else {
    
    ?> 
    
    display html form
    
    <? php } ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>Form Mail</title>
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <FORM action="mailto:smitty@work.com?subject=EVENT FORM"
    method=POST encType=text/plain>
    <input type=hidden name="subject" value="Form Mail Results">
    <input type=hidden name="required" value="fullname,email">
    <input type=hidden name="redirect"
    value="http://www.companywebsite.com/submission_received.htm">
    Name<br><input type=text name="fullname"><br>
    Email<br> <input type=text name="email"><br>
    <br> Comments<br> <textarea name="comments"></textarea> <br>
    <br> <input type="submit" name="Submit" value="Submit">
    </form>
    </body>
    </html>

  3. The Following User Says Thank You to gpigate For This Useful Post:

    Smitty (09-30-2008)

  4. #3
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    While I've been doing sites for a while, this is my first time venturing into forms. Given the code that you supplied above, I'm at a loss to determine how/where that would fit into my existing code.

  5. #4
    Join Date
    Jul 2007
    Location
    Irmo, SC
    Posts
    96
    Thanks
    10
    Thanked 7 Times in 7 Posts

    Default

    are you familiar with PHP?

    try this... of course you may want to change around your post vars, add your validation etc.

    Code:
    <?php 
    if ($_POST['send']=='Y'){
              $subject = $_POST['subject'];
    		  $name = $_POST['fullname'];
    		  $from = $_POST['email'];
              $comments = $_POST['comments'];
    		  
              $to = 'destination email address here ';
    		  
              $message = "Name of Sender: ".$name."\n\n";
              $message .= "Address of Sender: ".$from."\n\n";
              $message .= "Message: " . $_POST["comments"] . "\n\n";
    		  
              $headers = "From: ".$from."\n";
             
              mail($to, $subject, $message, $headers);
    		  
              header("Location: http://www.companywebsite.com/submission_received.htm");
        
    
    } else { 
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>Form Mail</title>
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <FORM action="testform.php" method="post" name="contactus" enctype="multipart/form-data">
    <input type=hidden name="subject" value="Form Mail Results">
    <input type=hidden name="required" value="fullname,email">
    <input type=hidden name="send" value="Y">
    <input type=hidden name="redirect" value="http://www.companywebsite.com/submission_received.htm">
    Name<br><input type=text name="fullname"><br>
    Email<br> <input type=text name="email"><br>
    <br> Comments<br> <textarea name="comments"></textarea> <br>
    <br> <input type="submit" name="Submit" value="Submit">
    </form>
    </body>
    </html> 
    <?php } ?>

  6. #5
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default That Worked!

    gpigate--

    THANK YOU for the assistance!

  7. #6
    Join Date
    Jul 2007
    Location
    Irmo, SC
    Posts
    96
    Thanks
    10
    Thanked 7 Times in 7 Posts

    Default

    not a problem. did that work for you?

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
  •