WEB ubernoob code question v. comment box & email

Discussion in 'OT Technology' started by psykosis, Dec 16, 2007.

  1. psykosis

    psykosis Go placidly amid the noise and the haste

    Joined:
    Oct 31, 2001
    Messages:
    123,808
    Likes Received:
    151
    Location:
    Listing between sin and salvation
    I'm in process of building a site, and I'm pretty much done. I just need to put a comment box in that feeds to an email account. I've never coded in anything but html (and I use dreamweaver for that), so I have no idea how to go about creating this. I've searched google, and I've gotten nothing. Please help! And keep it basic please, so that I might understand it...
     
  2. intrktevo

    intrktevo New Member

    Joined:
    Oct 18, 2004
    Messages:
    5,781
    Likes Received:
    0
    Location:
    UCF
  3. psykosis

    psykosis Go placidly amid the noise and the haste

    Joined:
    Oct 31, 2001
    Messages:
    123,808
    Likes Received:
    151
    Location:
    Listing between sin and salvation
    thanks. I'll start reading this.
     
  4. Franchise

    Franchise New Member

    Joined:
    Jan 27, 2005
    Messages:
    4,467
    Likes Received:
    0
    Location:
    Toronto
    also make sure you have a form verification field so you don't get to many spam submissions. You know one of those visual form verification fields. I still am looking at how to incorporate this into a form so I am looking at the answer for this too
     
  5. psykosis

    psykosis Go placidly amid the noise and the haste

    Joined:
    Oct 31, 2001
    Messages:
    123,808
    Likes Received:
    151
    Location:
    Listing between sin and salvation
    ok, I copied the code from that link and put it in my site, adjusting the email addresses in the code to mine after i pasted it. But upon further reading on that site, I see I need an email system and it needs to be defined in the php.ini file. What is that, and how do I do it? I know not this php voodoo...
     
  6. psykosis

    psykosis Go placidly amid the noise and the haste

    Joined:
    Oct 31, 2001
    Messages:
    123,808
    Likes Received:
    151
    Location:
    Listing between sin and salvation
    I've read some places that building this in java helps stop the spamming, but I know even less about java writing than I do about php. Not that that's saying much...
     
  7. intrktevo

    intrktevo New Member

    Joined:
    Oct 18, 2004
    Messages:
    5,781
    Likes Received:
    0
    Location:
    UCF
    Where is your site hosted? It should all be set up already for you.
     
  8. psykosis

    psykosis Go placidly amid the noise and the haste

    Joined:
    Oct 31, 2001
    Messages:
    123,808
    Likes Received:
    151
    Location:
    Listing between sin and salvation
    it will be on godaddy for now, until I decide on a dedicated server service.

    any way to test the script before uploading?

    this is what I have as of now...

    Code:
                <?php
    if (isset($_REQUEST['email']))
    //if "email" is filled out, send email
      {
      //send email
      $email = $_REQUEST['email'] ; 
      $subject = $_REQUEST['subject'] ;
      $message = $_REQUEST['message'] ;
      mail( "[email protected]", "Subject: $subject",
      $message, "From: $email" );
      echo "Thank you for using our mail form";
      }
    else
    //if "email" is not filled out, display the form
      {
      echo "<form method='post' action='mailform.php'>
      Email: <input name='email' type='text' /><br />
      Subject: <input name='subject' type='text' /><br />
      Message:<br />
      <textarea name='message' rows='15' cols='40'>
      </textarea><br />
      <input type='submit' />
      </form>
    
    </body>
    </html>
    		
     
  9. psykosis

    psykosis Go placidly amid the noise and the haste

    Joined:
    Oct 31, 2001
    Messages:
    123,808
    Likes Received:
    151
    Location:
    Listing between sin and salvation
    dreamweaver is giving me an error that states:

    But when I preview it in firefox or IE, it looks fine. But if I try to use it, after i hit Submit, it just clears the field and does not actually send an email. I suspect it is because the site is not hosted, but I'm not certain. Also, if the code is wrong, I cannot see where...
     
  10. trev.the.enemy

    trev.the.enemy New Member

    Joined:
    Jun 26, 2006
    Messages:
    10,939
    Likes Received:
    0
    Location:
    Midwest
    close your PHP tag

    Code:
    after </form> put ?>
    
     
  11. psykosis

    psykosis Go placidly amid the noise and the haste

    Joined:
    Oct 31, 2001
    Messages:
    123,808
    Likes Received:
    151
    Location:
    Listing between sin and salvation
    did that. now ?> shows up as text on the page.

    :confused:
     
  12. Nakon

    Nakon Guest

    you forgot to end the echo function. it goes like
    Code:
    echo "hello";
    
     
  13. psykosis

    psykosis Go placidly amid the noise and the haste

    Joined:
    Oct 31, 2001
    Messages:
    123,808
    Likes Received:
    151
    Location:
    Listing between sin and salvation
    where?
     
  14. psykosis

    psykosis Go placidly amid the noise and the haste

    Joined:
    Oct 31, 2001
    Messages:
    123,808
    Likes Received:
    151
    Location:
    Listing between sin and salvation
    fuck I suck at this shit...
     
  15. HighLife

    HighLife New Member

    Joined:
    Dec 16, 2007
    Messages:
    9,445
    Likes Received:
    0
    Location:
    Kansas
    Make sure that the file where you pasted the PHP ends with .php and not .htm/.html

    And use this code
    Code:
              <?php
    if (isset($_REQUEST['email']))
    //if "email" is filled out, send email
      {
      //send email
      $email = $_REQUEST['email'] ; 
      $subject = $_REQUEST['subject'] ;
      $message = $_REQUEST['message'] ;
      mail( "[email protected]", "Subject: $subject",
      $message, "From: $email" );
      echo "Thank you for using our mail form";
      }
    else
    //if "email" is not filled out, display the form
      {
      ?>
    <form method='post' action='mailform.php'>
      Email: <input name='email' type='text' /><br />
      Subject: <input name='subject' type='text' /><br />
      Message:<br />
      <textarea name='message' rows='15' cols='40'>
      </textarea><br />
      <input type='submit' />
      </form>
    <?php } //end if ?>
    
    </body>
    </html>
    
    You will need to look in php.ini and search for "mail"

    It should have the mail server information which you will need to make sure is active.. This will be a POP mailserver which godaddy should have available (you can call them)

    Hope this helps
     
  16. psykosis

    psykosis Go placidly amid the noise and the haste

    Joined:
    Oct 31, 2001
    Messages:
    123,808
    Likes Received:
    151
    Location:
    Listing between sin and salvation
    works perfect. thank you very much.
     

Share This Page