+ Reply to Thread
Results 1 to 6 of 6
Like Tree2Likes
  • 1 Post By ichwar
  • 1 Post By rjvilla

Thread: need help creating email box on site

  1. #1
    birrdesigns is offline x10Hosting Member birrdesigns is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    6

    need help creating email box on site

    I would like to create a page that allows viewers to type into a box and check radio buttons and then submit the information to me via email. I have very limited programming knowledge but would like to add this feature to my website. I have access to dreamweaver to edit my site. thanks to anyone who can give me any advice.

  2. #2
    monpire is offline x10Hosting Member monpire is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    16

    Re: need help creating email box on site

    Quote Originally Posted by birrdesigns View Post
    I would like to create a page that allows viewers to type into a box and check radio buttons and then submit the information to me via email. I have very limited programming knowledge but would like to add this feature to my website. I have access to dreamweaver to edit my site. thanks to anyone who can give me any advice.
    You can pretty much add mailto in the "method", but very insecure, read this:

    http://www.netmechanic.com/news/vol3/form_no4.htm

  3. #3
    ichwar's Avatar
    ichwar is offline Community Advocate ichwar is an unknown quantity at this point
    Join Date
    Dec 2008
    Location
    NC, USA
    Posts
    1,454

    Re: need help creating email box on site

    No, mailto isn't good I think. It's better to go with a php form that uses the mail() function.

    An example of this is something like this:

    form.html
    HTML Code:
    <form name="submit" action="send.php" type="post">
    <input type="text" name="message" />
    <input type="submit" value="submit" />
    </form>
    send.php
    PHP Code:
    <?php
    if ($_POST[message] == "")
    {
    header(form.html);
    exit;
    }

    $email "youremailaddresshere";
    $msg "$_POST[message]";
    mail($email$msg);

    $name"yournamehere";
    echo 
    "Your message" $msg "has been sent to" $name;
    ?>
    I'm going to need someone else here to confirm that code, since I typed it from memory so it is bound to have errors.
    But it's something to start with if you want to use the php mail() function.
    dinomirt96 likes this.

  4. #4
    rjvilla is offline x10Hosting Member rjvilla is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    8

    Re: need help creating email box on site

    Tons of email scripts out there that you can use. I agree that PHP is the best route.

    Try looking here:

    http://php.resourceindex.com/Complete_Scripts/

    You can google for more choices.
    karimirt47 likes this.

  5. #5
    omniuni is offline x10Hosting Member omniuni is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    21

    Post Re: need help creating email box on site

    Hi birrdesigns,

    Let's see what we can do. We'll write a piece of PHP code that...

    1. If the user has not clicked "Submit" display the form.
    2. If the user has submitted the form, send you a mail, and display a message.
    3. Uses only one page.
    4. Automatically finds values, so you don't need to modify the PHP, just the HTML for the form.
    OK. Wherever you want the form to display, just insert this code:

    PHP Code:
    <?php
    if($_POST['formsubmitted'] == true){
    $mailto 'youremail@example.com'//your email address here
    $subject 'eMail From Website'//change your subject line
    $message 'Message sent from website:'."\r\n"//header for the eMail
    //Notice the \r\n which adds a line break.

    //now let's assemble the message:
    foreach($_POST as $key => $value){
    if(
    strpos($key,'formvalue')){
    //this looks through the posted information to find anything submitted
    //that has "formvalue" as part of the name. It returns true if it does.
    $message.="$key$value \r\n"//appends the value along with the label to the message.
    }
    }

    //now we try to send, and if it works display a message.

    $successMessage 'Thank you for your time.'//Modify your message

    if(mail($mailto$subject$message)){
    //the mail function returns true if it is successful
    echo $successMessage;
    }else{
    echo 
    'I\'m sorry, there was a problem submitting your data.';
    }

    }else{
    //this is the form for information. note that all name attributes have
    //"formvalue-" as part of them, which will later be used to assemble the message.
    echo '
    <form action="?" method="post">
    What is your name? <input type="text" name="formvalue-name" size="30" />
    What is your age? <input type="text" name="formvalue-age" size="30" />
    <input type="submit" name="formsubmitted" value="true" />
    </form>
    '
    ;
    }
    ?>
    Good Luck! Let me know if that helps.
    Last edited by omniuni; 06-10-2009 at 10:01 AM.

  6. #6
    nirajkum is offline x10 Sophmore nirajkum is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    161

    Re: need help creating email box on site

    nice script omnuini ..... thnks

+ Reply to Thread

Similar Threads

  1. thats not my site
    By runewars in forum Free Hosting
    Replies: 3
    Last Post: 03-06-2009, 01:39 PM
  2. review my site
    By scummerz in forum Review My Site
    Replies: 24
    Last Post: 01-24-2009, 02:50 PM
  3. Is creating a site with my sql able to connect to game server?
    By kohhx in forum Computers & Technology
    Replies: 1
    Last Post: 05-03-2008, 02:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers