Results 1 to 10 of 16

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Problem redirecting upon form submission

    Have you tried ...?
    ?php
    zen_redirect("my_product_home");
    ?>
    Re: your first post, short tags are really not recommended.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  2. #2
    Join Date
    May 2008
    Posts
    31
    Plugin Contributions
    0

    Default Re: Problem redirecting upon form submission

    Thanks for your reply.

    Unfortunately, no luck with the change you recommended. Per your second recommendation, once I can get the redirect functionality working, I will make the change to get rid of my short tags.

    I have attached a small snapshot of what my screen looks like when I load index.php?main_page=my_test_page. As you can see, the header title "my_test_page" shows up but is blank underneath.
    Attached Images Attached Images  

  3. #3
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Problem redirecting upon form submission

    FAQ on troubleshooting blank pages (or blank "parts of pages"): https://www.zen-cart.com/tutorials/index.php?article=82
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    May 2008
    Posts
    31
    Plugin Contributions
    0

    Default Re: Problem redirecting upon form submission

    Thanks DrByte. I'll download the error debugging utility and give it a try. In the meantime, could you (or anybody else) give me the proper way to redirect from within a define page?

    Right now, all I have on my define redirect page is:

    Code:
    <?php zen_redirect("index.php?main_page=my_product_home"); ?>

    I've eliminated anything extraneous to get the redirect functionality working.

    Other than the usage of short tags, I am pretty sure this function call is written correctly. When I place the same function call in /modules/pages/my_test_page/header_php.php the redirect works fine. It seems to me that I simply don't know the correct way to redirect from within the define page, rather than the header. I've successfully written php scripts and redirected on other projects using header(location: $url) but something is different in this case.


    Thanks again for all your help.

    Dustin
    Last edited by dgsignal; 26 Jun 2008 at 02:24 AM. Reason: spelling error

  5. #5
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Problem redirecting upon form submission

    I doubt you'll have any success doing a header-redirect from inside the define_xxxxxx.php file of a define page ... because the HTML headers have already been sent to the page. Thus, PHP will not let you send redirect or any other header commands, since they must happen before any HTML content is sent to the browser.

    If you must do a redirect from that position, you'll probably have to do it with javascript.
    Or better yet, do it from within header_php.php, since that's the correct place to do form processing and redirects ... certainly much more appropriate there than in a template-output file as you're doing now.


    The real question is ... "why" are you trying to do a redirect from within a define page? What you've described seems like you're going about it the wrong way.

    If it's email processing of collected information, the following is a packaged approach: http://www.zen-cart.com/forum/showth...482#post386482
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    May 2008
    Posts
    31
    Plugin Contributions
    0

    Default Re: Problem redirecting upon form submission

    DrByte, thanks for the information. It's been obvious from the get go that I must be taking the wrong approach for my forms. What I'm hoping now is that you'll be able to give me some insight as to where and how my form integration should take place.

    My goal is to have a couple of forms that take in some information from the user, validate, then store it in a table in the database. Apparently, I have incorrectly assumed that I could put the html form tags and validation code into the define pages. Instead, should I place this code into the header_php.php file?

    Thanks again for your help. Your last email definitely got me headed in the right direction.

    Dustin

  7. #7
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Problem redirecting upon form submission

    It's not really that what you're doing is wrong. More that you're trying to do it from the wrong place.

    Each define page has a includes/modules/pages/page_name/header_php.php file and sometimes a main_vars.php file too. These normally process the data that will be used on the page and if a reason for a re-direct emerges, will execute it from there. This is probably where you should be executing yours.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

 

 

Similar Threads

  1. v153 Add custom form submission data access on Admin backend
    By fahadali in forum Customization from the Admin
    Replies: 9
    Last Post: 12 Feb 2016, 02:59 AM
  2. Odd extra elements in URL after form submission
    By gjh42 in forum Contribution-Writing Guidelines
    Replies: 5
    Last Post: 28 Aug 2014, 04:40 PM
  3. Retaining data in form submission
    By ethangreen in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 2 Jun 2009, 08:53 PM
  4. Simple Submission Form in EZ-Pages
    By pensive612 in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 18 Apr 2007, 10:46 PM
  5. required file on a submission form
    By iano in forum General Questions
    Replies: 1
    Last Post: 14 Oct 2006, 05:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg