• Resolved Doodlebee

    (@doodlebee)


    I have a contact form that I’ve developed from PHP. I love using it, because it’s taken me a while to get it where it is today, and it’s very effective and easy to use. However, it depends upon 3 files:

    1) contact.php – the file where the script is located, all functions are contained within this file.

    2) contact.html – the “layout” for the page. this is where they header and footer are, sidebar – all of that. The form elements, everything.

    3) accept.html – the “thank you” page that’s shown after the form is submitted.

    Now, I want my contact page to be part of my site. I’ve tried making it a “Page” in wordpress, but the PHP comes in all screwed up – most likely because the PHP in word press is conflicting with the PHP in my form files. I’ve tried placing the form outside of wordpress and just calling it by a link, but the problem with thatis I have to update every item on the page (sidebar stuff) anytime I update my site – which is a huge PITA.

    Is there some way I can save my html files as pages, and have my contact.php file call in those pages into the contact form – so wordpress will update the sidebar as needed, but not conflict with the functions of my contact form?

    I’m just at a loss as to what to do here.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Why don’t you try this highly customizable pugin?
    http://www.dagondesign.com/articles/secure-form-mailer-plugin-for-wordpress/

    Thread Starter Doodlebee

    (@doodlebee)

    Moshu –

    That would be great, except I want to use *my* form. Not only is it something I’m proud of, but my site is also one for information and downloads, and I’d hate to have my contact form available for download and usage if I can’t even use it on my own site – know what I mean?

    I guess I just need to figure out how to put PHP code in my wordpress site and have it function. Right now, I’m having an issue with line breaks – wordpress keeps putting in
    and tags in my code, and changing the ” to “ at random intervals. It makes no sense.

    Thread Starter Doodlebee

    (@doodlebee)

    I got it!

    WordPress Codex here

    For anyone else looking to do the same, basically, you just create your static page as you normally would, then apply the header, sidebar and footer with the addition of some WP code:

    <?php
    define('WP_USE_THEMES', false);
    require('./wordpress/wp-blog-header.php');
    get_header();
    ?>

    At the very top,

    <?php get_sidebar(); ?>

    where your sidebar resides, and

    <?php get_footer(); ?>

    for where your footer is. Save as a PHP file, upload to the top level of the directory, link to it, and BAM – the template is there as a static page, not really a part of your WordPress files, but still utilizing the system to make it *look* like it’s part of everything.

    Nice. My contact form works perfectly with it, and the sidebar is updated when I update the WordPress stuff – no conflicts whatsoever. It’s a beautiful thing!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP code contact form’ is closed to new replies.