Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > mySQL & PHP

Notices

mySQL & PHP Discussions, information and help with mySQL and PHP.

Reply
 
LinkBack Thread Tools
  #1  
Old 10-25-2006, 04:27 PM
AWS's Avatar
AWS AWS is offline
First Lieutenant
 
Join Date: Jan 2006
Posts: 168
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 10-25-2006, 06:00 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,288
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:


Quote:
<?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:


Quote:
<?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!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 10-25-2006, 06:08 PM
AWS's Avatar
AWS AWS is offline
First Lieutenant
 
Join Date: Jan 2006
Posts: 168
Default Re: adding a redirect code to php script

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

Best,
Liam
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 10-25-2006, 06:41 PM
AWS's Avatar
AWS AWS is offline
First Lieutenant
 
Join Date: Jan 2006
Posts: 168
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 10-25-2006, 07:58 PM
AWS's Avatar
AWS AWS is offline
First Lieutenant
 
Join Date: Jan 2006
Posts: 168
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 10:47 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC7
2005-2009 VodaHost Web Hosting Your Perfect Web Host - All Rights Reserved

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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176