Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5

Thread: Contact Page

  1. #1
    Member EdMarks's Avatar
    Join Date
    Nov 2011
    Location
    181 lat 91 long
    Posts
    51
    Member #
    29986
    Liked
    3 times
    Hello Everyone

    I am trying to make a contact page and having a hard time.

    Does anyone know a simple tutorial for this, to uses HTML to send an email via PHP or anything else that will work.

    The only thing is I cant have the contact page be a different web page. I simply need to have a form that uses CSS and Javascript for style and some function. But still uses PHP without getting in the way of the others.
    In other words it cant redirect the user once the submit button is clicked.

    Can I just add inline php code and call it a day?
    If so how?

    If you have read this far please check out what I am working on and look at my fail of a contact page.

    SITE I AM WORKING ON

    I could have sworn I had done this in the past. I just followed a tutorial but when I tried to apply it to my this site it resulted in and epic fail. Here is the site I used PHP in the past..

    PAST SITE

    Thanks for all help.

  2.  

  3. #2
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    Might be that the process you're using on this site is not supported by this hosting provider.

    Seriously, some hosting providers require you to use their mail scripts, or they have a certain way you have to send it ( a named smtp server ), for security reasons.

    I've seen some not even allow smtp mail from sites ( usually free hosting accounts )... It that's the case, your code is failing because they have the send mail function turned off...

    Check to see if there are any specifics with your hosting provider... If not then you fist need to setup a test a basic send script to get it working...

    Once you have that, then work on the contact form... To send info to the mail script.

    http://www.w3schools.com/php/php_mail.asp

    That should help with the basic send part of it for testing

  4. #3
    Member EdMarks's Avatar
    Join Date
    Nov 2011
    Location
    181 lat 91 long
    Posts
    51
    Member #
    29986
    Liked
    3 times
    Quote Originally Posted by Webzarus, post: 237952
    Might be that the process you're using on this site is not supported by this hosting provider......
    Hey Webzarus. Thanks for the response.
    I'ts not the hosting provider cuz I have another page in the same domain that works with the php mailer.
    It doesnt work cuz I don't know what I am doing.

    The main thing I am wondering is if there is a way to use php to mail a form without the webpage being a .php and with the page staying on the same html page the whole time.
    Cuz when I click submit it goes to the php form.

    Can I put inline script while keeping the .html or can the form call a .php script in the backgound without altering the user experience on the .html page?

    The link you sent is what I will need but it doesn't specify about my special specifications.

    :-)

  5. #4
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    Nope...

    HTML is static ( meaning the server sends the code as formatted)... When you call a php page, it invokes the scripting server side of things and tells it to process and execute the code on the php page.

    Just embedding the php in the HTML will not work..

    Don't know why you are so concerned...

    I guess you could put a redirect to a .html page after the php page processes... Many people send them to a thank you page... ( or whatever you want to call it )...

    If you code and layout is good, and your server response times to good, most people wouldn't even notice as the php page is processed in the background... And then they are sent ( wherever )...

  6. #5
    Junior Member SimplyWebsites's Avatar
    Join Date
    Jul 2012
    Location
    Leicester
    Posts
    27
    Member #
    32160
    I wrote this for someone else but it should help
    form.html:

    <form method="post" action="submit.php">
    <input type="text" name="firstname" />
    <input type="text" name="email" />
    <input type="text" name="company" />
    <input type="text" name="subject" />
    <textarea name="message" rows="5" cols="30"></textarea>
    <input type="submit" value="Send Message" />
    </form>

    Now that you have you form we need to create submit.php

    submit.php:

    <?
    // The email address you want messages to be sent to
    $your_email_address = "me@example.com";

    // First we need to get all the fields into variables.
    $firstname = $_POST['firstname'];
    $email = $_POST['email'];
    $company = $_POST['company'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];

    // Now lets create the email thats going to be sent to you!
    $subject = "New Contact Form Message";

    $the_email = "You have a new message from: $firstname"."\n\n";
    $the_email .= "Email: $email"."\n";
    $the_email .= "Company: $company"."\n";
    $the_email .= "Subject: $subject"."\n\n";
    $the_email .= "Message: $message"."\n\n";

    // Now lets send the email!
    mail($your_email_address,$subject,$the_email);
    ?>

    At the end of the submit.php you can add one more line to redirect them back to the form
    header('location:form.html');

    make sure you put this before the closing php tag


Remove Ads

Posting Permissions

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

Search tags for this page

html page to send info to other page

Click on a term to search for related topics.
All times are GMT -6. The time now is 02:33 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com