Results 1 to 3 of 3

Thread: Clicking on return_link shows contact form without applied styles or images

  1. #1
    Join Date
    Jul 2012
    Posts
    2

    Default Clicking on return_link shows contact form without applied styles or images

    Thank you very much for providing such an excellent tool and for free even.
    Thank you for the exceptional How-To Guides.
    Thank you for reading this post and possibly providing an answer. =)

    Problem:
    After the return link is clicked, the original contact form appears but without external styles applied nor images.

    Possible Explanation:
    The contact form's html code, which references the style sheet and images, is using a relative path. The fmbadhandler.php file does not know the correct root path to use. (The below code is truncated for example purposes)
    Code:
    <img src="images/image01.jpg"/>
    Code:
    <link href="styles/websitestyles.css" />
    Wanted Solution:
    1. After the return link is clicked, the original contact form appears as expected.
    2. A PHP variable is used to re-establish the root directory for the relative path within the contact form.
    3. The contact form does not require setting paths as either an absolute url or absolute path.



    Steps Already Taken:
    Changed the value of $SET_REAL_DOCUMENT_ROOT in both the files formmail.php and fmbadhandler.php to one of the following:
    • blank
    • /home1/mysite/public_html


    Understanding of folder tree and file placement:
    Site Root: (/home1/mysite/)
    (folder) contactform (not accessible to the general public)
    (file) formmail.ini
    (file) contact_errors.htm (the HTML template for errors)
    (folder) public_html (accessible to the general public by an internet browser)
    (file) contact.htm
    (file) thankyou.htm

    (folder) images
    (file) image01.jpg


    (folder) scripts
    (file) fmbadhandler.php
    (file) formmail.php
    (file) verifyimg.php


    (folder) styles
    (file) websitestyles.css


    Referenced How-To-Guides:
    - http://www.tectite.com/fmhowto/redir.php
    - http://www.tectite.com/fmhowto/adverror.php

    Form Hidden Fields: (contact.htm)
    Code:
    <input type="hidden" name="recipients" value="myvalue" />
    <input type="hidden" name="mail_options" value="PlainTemplate=template_email.txt,AlwaysList" />
    <input type="hidden" name="env_report" value="REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_HOST,REMOTE_USER" />
    <input type="hidden" name="good_url" value="http://the_name_of_the_website/thankyou.htm" />
    <input type="hidden" name="bad_url" value="http://the_name_of_the_website/scripts/fmbadhandler.php" />
    <input type="hidden" name="bad_template" value="contact_errors.htm" />
    <input type="hidden" name="this_form" value="http://the_name_of_the_website/contact.htm" />
    Error Page Fields: (contact_errors.htm)
    Code:
    <div id="contact_form_container"><div id="contact_form_container_quirks_IE8">
       <h1 class="centered">Please correct these errors!</h1>
       <div id="contact_form">
          <p id="contact_form_error_message">[fmerror /]</p>
          <ul id="contact_form_error_list">[fmerroritemlist /]</ul>
          <p class="centered"><a href="$return_link">Return to form</a></p>
       </div>
    </div></div><!-- end #contact_form_container -->
    PHP Variables: (formmail.php)
    Code:
    $SITE_DOMAIN = "";                                                          // your website domain name
                                                                                /* Help: http://www.tectite.com/fmdoc/site_domain.php */
    
    $SET_REAL_DOCUMENT_ROOT = "/home1/mysite/public_html";                      // overrides the value set by SetRealDocumentRoot function
                                                                                /* Help: http://www.tectite.com/fmdoc/set_real_document_root.php */
    
    $TARGET_URLS = array();                                                     // default; no URLs allowed
                                                                                /* Help: http://www.tectite.com/fmdoc/target_urls.php */
    
    $TEMPLATEDIR = "/home1/mysite/contactform";                                 // directory for template files; empty string if you don't have any templates
                                                                                /* Help: http://www.tectite.com/fmdoc/templatedir.php */
    
    $TEMPLATEURL = "";                                                          // default; no template URL
                                                                                /* Help: http://www.tectite.com/fmdoc/templateurl.php */
    
    define("PUT_DATA_IN_URL",false);                                            // set to true to place data in the URL for bad_url redirects
                                                                                /* Help: http://www.tectite.com/fmdoc/put_data_in_url.php */
    PHP Variables: (fmbadhandler.php)
    Code:
    $TARGET_URLS = array("http://the_name_of_the_website/contact.htm");         // default; no URLs allowed
    
    $SET_REAL_DOCUMENT_ROOT = "/home1/mysite/public_html";                      // overrides the value set by SetRealDocumentRoot function
    
    $TEMPLATEDIR = "/home1/mysite/contactform";                                 // directory for template files; empty string if you don't have any templates
    Thank you in advance for any and all helpful replies.
    Jonathan
    Last edited by jonathan_HPC; 29-Jul-2012 at 03:47 PM.

  2. #2
    Join Date
    Mar 2004
    Posts
    2,224

    Default Re: Clicking on return_link shows contact form without applied styles or images

    relative paths are fine if u fully understand wot is happening

    images and css and stuff are loaded by the browser. a relative path in ur HTML is relative to the URL shown in the browser address bar (unless the HTML specifies <base href="...">, in which case its relative to that URL)

    it's as simple as that.

    so, u have two choices:
    1. put formmail and fmbh in the same folder as ur form
    2. use an HTML <base href="..."> tag in ur HTML <head> section

  3. #3
    Join Date
    Jul 2012
    Posts
    2

    Default Re: Clicking on return_link shows contact form without applied styles or images

    Thank you, Crabtree, for the reply.

    I implemented option 2 by using the base tag within the page header of the contact.htm file. This method works beautifully.
    I have never needed to utilize the base tag so thank you for improving my education. And I am glad that the base tag passes validation.

    Thanks again,
    Jonathan

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Clicking submit button shows code in browser window
    By Diane in forum HOWTO Guides and Tips
    Replies: 4
    Last Post: 21-Nov-2009, 05:13 PM
  2. The HTML form shows the table outlines in the browser
    By Pablomon in forum Community Support
    Replies: 2
    Last Post: 26-Sep-2008, 10:09 PM
  3. Basic Contact Form
    By EpiscoPal in forum Sample Templates
    Replies: 2
    Last Post: 28-Sep-2007, 01:37 PM
  4. Replies: 0
    Last Post: 23-Apr-2007, 05:52 PM
  5. path to form shows up in address bar
    By dynamicmedia in forum FormMail Subscription Support
    Replies: 3
    Last Post: 09-Dec-2004, 11:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

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