www.webdeveloper.com
Results 1 to 3 of 3

Thread: Need my form to redirect to a web page after submission

  1. #1
    Join Date
    Jul 2010
    Posts
    3

    Need my form to redirect to a web page after submission

    I created a form on my web site that works great except for the fact that it doesn't redirect to the page on my web site that I want it to. I have it programmed to display a text message upon successful submission of the form, but it should be going to a page on my web site that I have setup for that purpose.

    How do I get this form to redirect to a page on my web site when submitted, instead of displaying the text message that it's displaying now?

    Here's the code I have ...
    Code:
    // Receiving variables
    @$pfw_ip= $_SERVER['REMOTE_ADDR'];
    @$Name = addslashes($_POST['Name']);
    @$Email = addslashes($_POST['Email']);
    @$Confirm_Email = addslashes($_POST['Confirm_Email']);
    @$Phone_Number = addslashes($_POST['Phone_Number']);
    @$Call = addslashes($_POST['Call']);
    @$Height = addslashes($_POST['Height']);
    @$Width = addslashes($_POST['Width']);
    @$Quantity = addslashes($_POST['Quantity']);
    @$Grommets = addslashes($_POST['Grommets']);
    @$Pole_Pockets = addslashes($_POST['Pole_Pockets']);
    @$Double_Sided = addslashes($_POST['Double_Sided']);
    @$Exact_Words_on_Banner = addslashes($_POST['Exact_Words_on_Banner']);
    @$Specific_Colors = addslashes($_POST['Specific_Colors']);
    @$Comments = addslashes($_POST['Comments']);
    
    // Validation
    if (strlen($Name) == 0 )
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a name. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email address. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (strlen($Email) == 0 )
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email address. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if ($Confirm_Email != $Email)
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please ensure that your email and confirm email match. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (strlen($Confirm_Email) == 0 )
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please ensure that your email and confirm email match. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (strlen($Phone_Number) !=10)
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid ten digit phone number including area code and no dashes. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (strlen($Phone_Number) == 0 )
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid ten digit phone number including area code and no dashes. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (strlen($Call) == 0 )
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid call. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if ( $Height <= 0)
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid height greater than 0 feet. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (strlen($Height) == 0 )
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid height greater than 0 feet. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if ( $Width <= 0)
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid width greater than 0 feet. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (strlen($Width) == 0 )
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid width greater than 0 feet. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if ( $Quantity <= 0)
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a quantity. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (strlen($Quantity) == 0 )
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a quantity. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (strlen($Grommets) == 0 )
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid grommets. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (strlen($Pole_Pockets) == 0 )
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid pole_pockets. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    if (strlen($Double_Sided) == 0 )
    {
    die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid double_sided. If you're having issues with our order form, please contact us 27/4 @ 602-68-VINYL or Support@BannersForCheap.com</font></p>");
    }
    
    //Sending Email to form owner
    $pfw_header = "From: $Confirm_Email\n"
      . "Reply-To: $Confirm_Email\n";
    $pfw_subject = "Banner Order";
    $pfw_email_to = "nickwhall@gmail.com";
    $pfw_message = "Visitor's IP: $pfw_ip\n"
    . "Name: $Name\n"
    . "Email: $Email\n"
    . "Confirm_Email: $Confirm_Email\n"
    . "Phone_Number: $Phone_Number\n"
    . "Call: $Call\n"
    . "Height: $Height\n"
    . "Width: $Width\n"
    . "Quantity: $Quantity\n"
    . "Grommets: $Grommets\n"
    . "Pole_Pockets: $Pole_Pockets\n"
    . "Double_Sided: $Double_Sided\n"
    . "Exact_Words_on_Banner: $Exact_Words_on_Banner\n"
    . "Specific_Colors: $Specific_Colors\n"
    . "Comments: $Comments\n";
    @mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
    
    //Sending auto respond Email to visitor
    $pfw_header = "From: support@bannersforcheap.com\n"
      . "Reply-To: support@bannersforcheap.com\n";
    $pfw_subject = "Banners For Cheap :: Banner Order Received";
    $pfw_email_to = "$Confirm_Email";
    $pfw_message = "Thank you for your banner order.\n"
    . "\n"
    . "We have received it and we're formulating a design proof to be sent to you.\n"
    . "\n"
    . "Expect a design proof within 24 hours of your placed order. We usually get design proofs out within minutes of an order.\n"
    . "\n"
    . "We're available 24/7 at support@bannersforcheap.com and 602-68-VINYL.\n"
    . "\n"
    . "Regards,\n"
    . "Banners For Cheap.com Team";
    @mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
    
     echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>Thank you for your banner order. Expect a design proof sent to your inbox for approval within 24 hours. Feel free to call us 24/7 at 602-68-VINYL or email us at Support@BannersForCheap.com</font></p>");
    ?>

  2. #2
    Join Date
    Jan 2006
    Location
    Indiana, USA
    Posts
    79
    Normally, you'd use the form tag in your html to direct to the page.

  3. #3
    Join Date
    Mar 2010
    Posts
    2,803
    PHP's header() will redirect a web page to another page as long as their has been no previous output.

    Another option you have is to write php code to generate the javascript to change window.location.href to point to the redirect url.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles