Results 1 to 8 of 8
  1. #1
    Join Date
    May 2006
    Posts
    313
    Plugin Contributions
    0

    Default Simple Submission Form in EZ-Pages

    Hey everyone,

    I need to create an EZPage that has 3 fields and a submit button. All can easily be done in HTML form. I also have a very simple mail script that works perfectly. But... I can't get the EZPage to call the mail script properly.

    I'm assuming this has something to do with not being able to use PHP in EZ-Pages.

    Does anyone have an easy way to add a simple form in an EZPage?

    I did see Dr. Bytes extremely informative how to for a complex template based form. My needs are just much much simpler...

    Any advice would be appreciated.

    Thanks in advance.

  2. #2
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: Simple Submission Form in EZ-Pages

    Are you simply looking to e-mail the results of the form to someone, or do you need the data to be written into the database?
    20 years a Zencart User

  3. #3
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: Simple Submission Form in EZ-Pages

    You can try this... All four files reside in the same directory. This is NOT being used by us on zencart, so there is NO WARRANTY. You may need to modify the html headers (or remove them) if you strip the BODY code into other pages.

    File One - contact.php

    PHP Code:
    <?php

    // ** This simple php script drives an input form included with this package
    // ** You can change the FIELD NAMES if you wish - just ensure that whatever name you choose CORRESPONDS
    // **   with the input names on "contact.html". The field names must be changed in SECTIONS 1, 2 and 3 below.
    // **
    // ** You can also ADD fields (see the commented out examples below)


    // SECTION ONE
    // get posted data into local variables
    $EmailFrom Trim(stripslashes($_POST['EmailFrom']));
    $EmailTo "[email protected]"//The email address to which you want the data to be sent.
    $Subject "SUBJECT OF EMAIL"//Enter the desired SUBJECT for this email.
    $FirstName Trim(stripslashes($_POST['FirstName'])); 
    $LastName Trim(stripslashes($_POST['LastName'])); 
    $Company Trim(stripslashes($_POST['Company'])); 
    $Country Trim(stripslashes($_POST['Country'])); 
    $Tel Trim(stripslashes($_POST['Tel'])); 
    $Website Trim(stripslashes($_POST['Website'])); 
    $Comments Trim(stripslashes($_POST['Comments'])); 
    //$NewField = Trim(striplashes($_POST['NewField']));


    // SECTION TWO
    // validation (These set ALL fields as REQUIRED fields)
    // To remove validation for any given field, comment it out - eg:
    // if (Trim($EmailFrom)=="") $validationOK=false;
    $validationOK=true;
    if (
    Trim($EmailFrom)==""$validationOK=false;
    if (
    Trim($FirstName)==""$validationOK=false;
    if (
    Trim($LastName)==""$validationOK=false;
    if (
    Trim($Company)==""$validationOK=false;
    if (
    Trim($Country)==""$validationOK=false;
    if (
    Trim($Tel)==""$validationOK=false;
    if (
    Trim($Website)==""$validationOK=false;
    if (
    Trim($Comments)==""$validationOK=false;
    //if (Trim($NewField)=="") $validationOK=false;
    if (!$validationOK) {
      print 
    "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
      exit;
    }

    //SECTION THREE
    // prepare email body text
    $Body "";
    $Body .= "FirstName: ";
    $Body .= $FirstName;
    $Body .= "\n";
    $Body .= "LastName: ";
    $Body .= $LastName;
    $Body .= "\n";
    $Body .= "Company: ";
    $Body .= $Company;
    $Body .= "\n";
    $Body .= "Country: ";
    $Body .= $Country;
    $Body .= "\n";
    $Body .= "Tel: ";
    $Body .= $Tel;
    $Body .= "\n";
    $Body .= "Website: ";
    $Body .= $Website;
    $Body .= "\n";
    $Body .= "Comments: ";
    $Body .= $Comments;
    $Body .= "\n";
    //$Body .= "NewField: ";
    //$Body .= $NewField;
    //$Body .= "\n";

    //SECTION FOUR
    // send email 
    $success mail($EmailTo$Subject$Body"From: <$EmailFrom>");

    // redirect to success page (or if ERROR, redirect to error page)
    if ($success){
      print 
    "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.html\">";
    }
    else{
      print 
    "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
    }
    ?>

    File Two - contact.html
    HTML Code:
    <!--This is the html code for the INPUT form that is driven by "contact.php".
    Place it between the BODY tags of your html page and put it in the same directory as "contact.php"
    Remember, if you de-validate fields in the PHP file, remove the relative asterisks in the text below. -->
    
    <span><h3>Contact Form</h3></span>
    <p>Please complete the form and submit it to us.
        
    
    
    <form method="POST" action="contact.php">
    Fields marked (*) are required
    
    <p>Your Email Address:* <br />
    <input type="text" name="EmailFrom" size="45">
    <br />First Name:* <br />
    <input type="text" name="FirstName" size="45">
    <br />Last Name:* <br />
    <input type="text" name="LastName" size="45">
    <br />Company:* <br />
    <input type="text" name="Company" size="45">
    <br />Country:* <br />
    <input type="text" name="Country" size="45">
    <br />Telephone (include area codes):* <br />
    <input type="text" name="Tel" size="45">
    <br />Website (if you have one):*<br />
    <input type="text" name="Website" size="45">
    <br />Comments / Questions:*<br />
    <textarea name="Comments" rows="4" cols="50"></textarea>
    <br /><input type="submit" name="submit" value="Submit">
    </form>
    <!-- if you ADD a NewField to this form, you need to modify contact.php too -->

    File Three - thanks.html
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html lang="en-GB">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Thank You</title>
    </head>
    
    <body>
    
    	<h1>Thank You</h1>
    	<div>
    	<h2>&nbsp;</h2>
    	<h2>We have received your message</h2>     
        <p>We will respond soon.</p>
       	</div>
    
    
    </body>
    </html>

    File Four - error.html
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html lang="en-GB">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta http-equiv="Expires" content="-1" />
    <title>Oops - there is an error</title>
    
    </head>
    
    <body>
    
    	<h1>Oops! Something's not quite right...</h1>
    	<div>
    	<h2>&nbsp;</h2>
    	<h2>We've encountered an error</h2>     
        <p>Perhaps you did not enter information into a "required" field, or there was a fault in the submission process.<br /><br />
    	Please use the "Return to Previous Page" button and complete the form again. If you still experience problems, please contact us by telephone.<br />
        </p>
        <form>
          <div align="center"><center><p><input TYPE="button" VALUE="Return to previous page" onClick="history.go(-1)">&nbsp; </p>
          </center></div>
        </form>
       	</div>
     
    </body>
    </html>
    20 years a Zencart User

  4. #4
    Join Date
    May 2006
    Posts
    313
    Plugin Contributions
    0

    Default Re: Simple Submission Form in EZ-Pages

    Thanks so much, Schoolboy.

    I'm right in the middle of the Dr. Byte Band Signup Tutorial. But if that doesn't work perfect, this is the next strategy.

    Thanks again, for all the time you put into it.

    I will definitely keep you updated...


    Adam.

  5. #5
    Join Date
    Feb 2007
    Posts
    76
    Plugin Contributions
    0

    Default Re: Simple Submission Form in EZ-Pages

    Hi, I wanted to try this but was not sure where to save the files. What folder should they be saved in?

  6. #6
    Join Date
    Feb 2007
    Location
    Worldwide Web
    Posts
    191
    Plugin Contributions
    0

    Default Re: Simple Submission Form in EZ-Pages

    I would liek to know this also:

    Hi, I wanted to try this but was not sure where to save the files. What folder should they be saved in?
    Diva Boutiques
    www.divaboutiques.com

  7. #7
    Join Date
    Apr 2007
    Posts
    13
    Plugin Contributions
    0

    Default Re: Simple Submission Form in EZ-Pages

    Is it just me, or isa there an issue within the define pages editor which will not allow you to add a value'"submit" correctly.

    I created a thread about this elsewhere, and seem to be talking to myself, so I'll try asking in here as well (I've relentlessly searched these forums).

    When I paste in a contact from I made into the define pages editor, somehow, (when I go back in to edit the same page) the submit button has embedded itself into the define_pages_editor.php. I believe it has something to do with admin/includes/functions/html_output, but I'm not able to figure out hwat to modify. Basically, the text area is being comprimised by the form code, thusly 'submit' becomes part of the page.

    This is very hard to explain, I undersatnd...hehe. However, I'm unsure of how else to do it. If anyone thinks a screenshot would help, I'd be more than happy to provide a series of them documenting this issue as it happens. However, I think there could be a fairly simple cure for it.

    PS:

    I even tried th above posted form, just to see if it would work. No go. I should also mention that right now, everything LOOKS fine from the user end, but were I to try and edit the page, clicking on 'save' would not even be an option...I would actually have to click the submit button which is now embedded. Whenthat is done, the textarea on the user end is suddenly full of footer code, and the page itself has no footer to speak of.

    Haha...this sounds mildly psychotic.

    Cheers

  8. #8
    Join Date
    May 2006
    Posts
    313
    Plugin Contributions
    0

    Default Re: Simple Submission Form in EZ-Pages

    Ditch,

    I wish I could help solve it, but I've never run into that problem.

    I might suggest using a code editor instead, though. I do everything with BBedit and Dreamweaver, and have not run into any problems creating the new forms.

    I know there are some free ones out there for PC and Mac. And it would give you much more control over the code.

    Anyway, that's my advice.

    Hope all is good.

 

 

Similar Threads

  1. Retaining data in form submission
    By ethangreen in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 2 Jun 2009, 08:53 PM
  2. Problem redirecting upon form submission
    By dgsignal in forum Templates, Stylesheets, Page Layout
    Replies: 15
    Last Post: 26 Jun 2008, 06:16 PM
  3. Replies: 13
    Last Post: 3 Sep 2007, 11:43 PM
  4. Getting Rid of ecommerce - order information as a simple email submission
    By threeopus3 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 13 Nov 2006, 04:31 AM
  5. required file on a submission form
    By iano in forum General Questions
    Replies: 1
    Last Post: 14 Oct 2006, 05:16 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR