+ Reply to Thread
Results 1 to 5 of 5

Thread: adding a redirect code to php script
      
   

  1. #1
    AWS's Avatar
    AWS
    AWS is offline First Lieutenant
    Join Date
    Jan 2006
    Posts
    172

    Smile adding a redirect code to php script

    Hi,

    I have a php script (got from vodahost) to my root directory at http://www.pantryhamper.ie which is working fine but as the message that you view when published is clashing with the websites coluors(background & text) then I wish to clone a web page and place my message here and automatically redirect to this page when online form is submitted.

    Can I add a redirect code to my existing php script so as to allow this while keeping the form working in every other aspect?

    If yes then where do I add this code and what exact piece of code do I need?

    The php scrip that I have already in use is as follows.........

    <HTML>
    <HEAD>
    <TITLE>SUCESSFULLY PROCESSED YOUR ORDER/ENQUIRY</TITLE>
    </HEAD>
    <BODY>
    <H2>thank you for your order/enquiry to pantry hamper.a member of pantry hamper will reply as soon as possible!</H2>
    <?PHP
    $email=$HTTP_POST_VARS[email];
    $mailto="info@pantryhamper.ie";
    $mailsubj="Online Order/Enquiry Contact Form";
    $mailhead="from:$email\n";
    reset($HTTP_POST_VARS);
    $mailbody="Values submitted from website form:\n";
    while(list($key,$val)=each($HTTP_POST_VARS))
    {
    $mailbody.="$key:$val\n";
    }
    mail($mailto,$mailsubj,$mailbody,$mailhead);
    ?>
    </BODY>
    </HTML>

    Thanks,
    Liam

  2. #2
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: adding a redirect code to php script

    If i understand well:

    Solution 1: combine a custom made Thankyou page with the script: Create a page as you like it. In your case you must save it as "order_inframe", Make it the same dimensions of your i-frame.


    Now, the script must become as follows:


    <?PHP
    $email=$HTTP_POST_VARS[email];
    $mailto="info@pantryhamper.ie";
    $mailsubj="Online Order/Enquiry Contact Form";
    $mailhead="from:$email\n";
    reset($HTTP_POST_VARS);
    $mailbody="Values submitted from website form:\n";
    while(list($key,$val)=each($HTTP_POST_VARS))
    {
    $mailbody.="$key:$val\n";
    }
    mail($mailto,$mailsubj,$mailbody,$mailhead);
    ?>
    Copy this code. Go back in your page (order_inframe) and click on View, Pahe HTML
    Click on" Inside Body" and paste the code in there. Also, go in Page Properties, and where you see "File extension" set it to php. Save the page and publish it. It will take the place of your script (order_inframe.php) but it will have the layout that you have created.

    Have a look at http://www.vodahost.com/vodatalk/for...sing-form.html

    It os the same method, only the script is different, as the one in this link will also upload files if necessary.

    Solution 2: redirect the script after submission to a thankyou page:

    Create a "thankyou_page" as you like it. Save it as "thankyou_page" and publish it normally.
    Modify your script as follows:


    <?PHP
    $email=$HTTP_POST_VARS[email];
    $mailto="info@pantryhamper.ie";
    $mailsubj="Online Order/Enquiry Contact Form";
    $mailhead="from:$email\n";
    reset($HTTP_POST_VARS);
    $mailbody="Values submitted from website form:\n";
    while(list($key,$val)=each($HTTP_POST_VARS))
    {
    $mailbody.="$key:$val\n";
    }
    mail($mailto,$mailsubj,$mailbody,$mailhead);
    header("Location: thankyou_page.html");
    ?>
    replace your script with this one and you are done.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  3. #3
    AWS's Avatar
    AWS
    AWS is offline First Lieutenant
    Join Date
    Jan 2006
    Posts
    172

    Default Re: adding a redirect code to php script

    Thanks Navaldesign,I will follow these instructions to the letter.Thanks again.

    Best,
    Liam

  4. #4
    AWS's Avatar
    AWS
    AWS is offline First Lieutenant
    Join Date
    Jan 2006
    Posts
    172

    Red face Re: adding a redirect code to php script

    Hi Naval design,

    I followed solution 2 as you have laid out above but keep getting the following error message when submitting......

    Warning: Cannot modify header information - headers already sent by (output started at /home2/pfjywgyr/public_html/order_inframe.php:2) in /home2/pfjywgyr/public_html/order_inframe.php on line 14


    The following is the php script used.....


    <?PHP
    $email=$HTTP_POST_VARS[email];
    $mailto="info@pantryhamper.ie";
    $mailsubj="Online Order/Enquiry Contact Form";
    $mailhead="from:$email\n";
    reset($HTTP_POST_VARS);
    $mailbody="Values submitted from website form:\n";
    while(list($key,$val)=each($HTTP_POST_VARS))
    {
    $mailbody.="$key:$val\n";
    }
    mail($mailto,$mailsubj,$mailbody,$mailhead);
    header("Location:http://www.pantryhamper.ie/thank_you.html");
    ?>


    Did I go wrong in the header? should I have typed the full url or what you had typed out?

    There was a space between the : and thankyou_page of which I removed.....should I have done this?

    Sorry for taking more of your time on this but will you write out php script exactly as I should use for the page (now published) titled thank_you for http://www.pantryhamper.ie

  5. #5
    AWS's Avatar
    AWS
    AWS is offline First Lieutenant
    Join Date
    Jan 2006
    Posts
    172

    Thumbs up Re: adding a redirect code to php script

    Hi Naveldesign,

    Scratch my last post as all working fine.

    The space was the problem and caused the error.

    Thanks for all your help and talk to you soon.

    Best Regards,
    Liam.

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49