Welcome to TalkGraphics.com
Results 1 to 10 of 20

Thread: Contact Form

Hybrid View

  1. #1

    Default Contact Form

    OK, so I am reluctant to post this because when I searched the archives there were lots of comments from forum members about this subject being "already discussed multiple times".

    But I can assure you I have looked at them all and still am not getting anywhere.

    I want to create a .php contact form on the Contact page. I don't want flash. My host enables php content. Here is the code that I have been trying:

    <?PHP
    $to = "insert email here";
    $subject = "Results from your Request Info form";
    $headers = "From: Form Mailer";
    $forward = 0;
    $location = "";

    $date = date ("l, F jS, Y");
    $time = date ("h:i A");



    $msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

    if ($_SERVER['REQUEST_METHOD'] == "POST") {
    foreach ($_POST as $key => $value) {
    $msg .= ucfirst ($key) ." : ". $value . "\n";
    }
    }
    else {
    foreach ($_GET as $key => $value) {
    $msg .= ucfirst ($key) ." : ". $value . "\n";
    }
    }

    mail($to, $subject, $msg, $headers);
    if ($forward == 1) {
    header ("Location:$location");
    }
    else {
    echo "Thank you for submitting our form. We will get back to you as soon as possible.";
    }

    ?>

    If I paste it into a placeholder under 'html code (body) and check 'Re-generate placeholder image automatically' it looks like script in a box.

    I can paste this one and it looks normal:

    <FORM name="form" action="/contactform/contactscript.php" method="post">
    <TABLE cellSpacing="2" cellPadding="2" width="400" border="0">
    <TBODY>
    <TR>
    <TD vAlign="top" align="right" width="200">Your Name: </TD>
    <TD vAlign="top" align="left" width="200"><INPUT maxLength="200" size="25" name="name"> </TD></TR>
    <TR>
    <TD vAlign="top" align="right" width="200">Your Email: </TD>
    <TD vAlign="top" align="left" width="200"><INPUT maxLength="100" size="25" name="email"> </TD></TR>
    <TR>
    <TD vAlign="top" align="right" width="200">Your Comments: </TD>
    <TD vAlign="top" align="left" width="200"><TEXTAREA name="msg" rows="4" cols="25"></TEXTAREA> </TD></TR>
    <TR>
    <TD vAlign="top" width="200"></TD>
    <TD vAlign="top" align="left" width="200"><INPUT type="reset" value="Reset" name="Reset"> <INPUT type="submit" value="Submit" name="Submit"> </TD></TR></TBODY></TABLE></FORM>

    But it doesn't point anywhere.

    in both cases, nothing is in the page <head>.

    I downloaded other free contact form php scripts and pasted them into the placeholder html body and I still get a box with script in it.

    So what am I doing wrong? Please?

    John

  2. #2
    Join Date
    Aug 2010
    Posts
    533

    Default Re: Contact Form

    Hi John, firstly your page needs to have a .php extension you can do this by adding .php to your page name as long as it's not the first page in the list.
    Place the PHP script in the (head).
    Then remove action="/contactform/contactscript.php" from the form code so that the form gets submitted to the same page

  3. #3

    Default Re: Contact Form

    Quote Originally Posted by jamesd View Post
    Hi John, firstly your page needs to have a .php extension you can do this by adding .php to your page name as long as it's not the first page in the list.
    Place the PHP script in the (head).
    Then remove action="/contactform/contactscript.php" from the form code so that the form gets submitted to the same page
    Thanks for the reply James.

    1. You are referring to the Second script in my OP. Is that correct.

    2. If I Right click on the Contact page and choose Web Properties, it says page filename - 'contact'. Do I change that to 'contact.php'?

    John

    EDIT: That didn't work at all. It created a contact form in the upper left hand corner despite my placement and changed the menu button to Contact.php

  4. #4
    Join Date
    Aug 2010
    Posts
    533

    Default Re: Contact Form

    Place the PHP script in the (head)
    I am refering to the first piece of code in your OP. The second piece of code in your OP needs to be in the (body). This why the form was showing in the top left corner.

    and changed the menu button to Contact.php
    Using the menu manager you can remove .php from the menu without it affecting the page name.

  5. #5
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,828

    Default Re: Contact Form

    John, sorry it is so frustrating.

    I try and do these things step-by-step.

    Ignore the FORM and PHP. Can you change the contact filename to contact.php in Web Properties > Page > Page filename?
    When you publish, not export, does the page render in your browser?

    When you add the Placeholder body code for the FORM, apart from it not submitting, does it appear and allow data input and button presses?

    When you add in the PHP code to the Page head code, does all now work?

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  6. #6

    Default Re: Contact Form

    Thanks to both of you for the responses. I have been at this for around 15 hours so far and am getting nowhere.

    The suggestions render a box with code displayed. I decided to forget about the code above and tried this next:

    http://reusableforms.com/d/e1/php-co...ith-validation

    1. I downloaded the form. Unzipped the files and Edited the "handler.php file to reflect the proper email address as they said in the readme.

    2. In their video demo they said to rename and upload the entire folder that is created to the web host Cpanel and test the form by opening formpage.html (which is part of the folder)

    https://youtu.be/jAr4ZtLnmn0

    3. I did that and the form displayed perfectly and worked perfectly (but that was directly from the Cpanel).

    4. What they did not explain is how to get it on a webpage. I searched for hours and there was no clue. I entered the code from "handler.php" into the head of the placeholder checking "Re-Generate placeholder image automatically", and I get a box with code written in it. Preview the "Contact" page in a browser and it is blank. Add a .php extension to the page name and all the code is displayed in the webpage preview. Looked for a forum for ReusableForms and they don't have one.

    5. I don't really want to do this but I can take the Contact menu button and create a link to the "formpage.html" file directly in that folder on the server, but I don't know if that is safe or not. From there a hacker could probably get into the rest of the directory.

    John
    Last edited by craftech; 14 August 2018 at 05:06 PM.

 

 

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
  •