fan4chevy Posted March 9, 2010 Share Posted March 9, 2010 Hi, I am trying to figure out how to redirect to my tell_a_friend.php page after 5 seconds while not losing session. This would enable the customer to be able to read the successful email text but then redirect to the tell_a_Friend.php so that they can send another if wanted. Please inform me of what I am doing incorrectly as it is erroring and not going to page. Here is what I tried to do but not working: <?php require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_TELL_A_FRIEND); ?> <tr> <td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . '', HEADING_TITLE, '0', '0', 'align="left"') . TEXT_TABS_EMAIL_SUCCESS; ?> </td> </tr> <?php header("refresh: 5; . FILENAME_TELL_A_FRIEND"; ?> ------- Thank you. Link to comment Share on other sites More sharing options...
germ Posted March 9, 2010 Share Posted March 9, 2010 sleep(5); tep_redirect( tep_href_link( FILENAME_TELL_A_FRIEND ) ); If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
spooks Posted March 9, 2010 Share Posted March 9, 2010 Take care, google does not like auto-redirects, so only use on non-indexable pages. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
fan4chevy Posted March 10, 2010 Author Share Posted March 10, 2010 Take care, google does not like auto-redirects, so only use on non-indexable pages. Thanks to both of you. I will install the code hopefully I make it work. Basically I am using product tabs in product info the one that has lighter code and not the admin side. So the tell a friend is in a tab. The tabs tell a friend I noticed does not redirect back to the main fields page but rather just stays at the successful text section. THanks Link to comment Share on other sites More sharing options...
fan4chevy Posted March 10, 2010 Author Share Posted March 10, 2010 Ok I encountered some errors. I am not a php'er only can do basics so bear with me. Here is the error: Your email about this product has been successfully sent. Warning: Cannot modify header information - headers already sent by (output started at /home/citysur/public_html/iadecor.com/tell_a_friend2.php:6) in /public_html/cor.com/includes/functions/general.php on line 34 Here is how I have the code: <?php require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_TELL_A_FRIEND); ?> <tr> <td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . '', HEADING_TITLE, '0', '0', 'align="left"') . TEXT_TABS_EMAIL_SUCCESS; ?> </td> </tr> <?php sleep(5); tep_redirect( tep_href_link( FILENAME_TELL_A_FRIEND ) ); ?> ------- What I need is to get the tellafriend located under the tabs to allow the customer to send another message if desired rather than just look at the success message. Your help is appreciated. Link to comment Share on other sites More sharing options...
germ Posted March 10, 2010 Share Posted March 10, 2010 Ok I encountered some errors. I am not a php'er only can do basics so bear with me. Here is the error: Your email about this product has been successfully sent. Warning: Cannot modify header information - headers already sent by (output started at /home/citysur/public_html/iadecor.com/tell_a_friend2.php:6) in /public_html/cor.com/includes/functions/general.php on line 34 Here is how I have the code: <?php require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_TELL_A_FRIEND); ?> <tr> <td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . '', HEADING_TITLE, '0', '0', 'align="left"') . TEXT_TABS_EMAIL_SUCCESS; ?> </td> </tr> <?php sleep(5); tep_redirect( tep_href_link( FILENAME_TELL_A_FRIEND ) ); ?> ------- What I need is to get the tellafriend located under the tabs to allow the customer to send another message if desired rather than just look at the success message. Your help is appreciated. You can't do it like that. Even if there were no errors it wouldn't work. Your in FILENAME_TELL_A_FRIEND and right at the top you do a redirect to FILENAME_TELL_A_FRIEND. That's called the proverbial endless loop... :-" If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
fan4chevy Posted March 11, 2010 Author Share Posted March 11, 2010 You can't do it like that. Even if there were no errors it wouldn't work. Your in FILENAME_TELL_A_FRIEND and right at the top you do a redirect to FILENAME_TELL_A_FRIEND. That's called the proverbial endless loop... :-" Hmmm!, Well is there a way for the product tabs to refresh back to the initial so that the customer can send another message? It is setup as tell_a_friend.php and then goes to tell_a_friend2.php whereas the latter has the success message. Link to comment Share on other sites More sharing options...
germ Posted March 12, 2010 Share Posted March 12, 2010 Hmmm!, Well is there a way for the product tabs to refresh back to the initial so that the customer can send another message? It is setup as tell_a_friend.php and then goes to tell_a_friend2.php whereas the latter has the success message. In the top potion of tell_a_friend.php if you change this code: tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); To: $messageStack->add('friend', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info['products_name'], tep_output_string_protected($to_name)), 'success'); // tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); It displays a success message on the page and stays on that page so they could do it again. They would then use the "back" button as a method to get off the page and back to where they cam from. That may not be exactly what you want but it works (I tested it). If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
fan4chevy Posted March 12, 2010 Author Share Posted March 12, 2010 In the top potion of tell_a_friend.php if you change this code: tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); To: $messageStack->add('friend', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info['products_name'], tep_output_string_protected($to_name)), 'success'); // tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); It displays a success message on the page and stays on that page so they could do it again. They would then use the "back" button as a method to get off the page and back to where they cam from. That may not be exactly what you want but it works (I tested it). Thank you for you assistance. I did the changes. However, what it did is send the email and indeed stayed on the same page but it left all the email addy and name in the fields and did not add the success text to the top. The ask a question and the tell a friend are in Tabs on the page from the tabs contribution. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.