Results 1 to 6 of 6

Thread: PHP Form Mail Script

  1. #1
    Join Date
    Nov 2006
    Posts
    41
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default PHP Form Mail Script

    I am trying to get a simple form mail script to work, with no luck so far. I came across a basic version of the below script and modified it for my use. However, it's giving me a 500 Internal Error. Here is my php script:

    PHP Code:
    <? 
    if ($_POST["Submit"]){ 

    if (
    $_POST["Name"] and $_POST["Address"] and $_POST["Apt_Suite"] and $_POST["City"] and $_POST["Province"] and $_POST["Postal_Code"] and $_POST["Phone"] and $_POST["Email"] and $_POST["Publication_Title"] and $_POST["#_Copies_English"] and $_POST["#_Copies_French"] and $_POST["Details"]){ 

    mail 
    "eday2010@gmail.com"
    "Publication Order Request (EN)"

    Name:     "
    .$_POST['Name'].
    Address:     "
    .$_POST['Address'].
    Apt/Suite:     "
    .$_POST['Apt_Suite'].
    City:     "
    .$_POST['City'].
    Province or Territory:     "
    .$_POST['Province'].
    Postal Code:     "
    .$_POST['Postal_Code'].
    Phone:  "
    .$_POST['Phone'].
    E-mail:   "
    .$_POST['Email'].
    Publication Title:  "
    .$_POST['Publication_Title'].
    # of English Copies:  "
    .$_POST['#_Copies_English'].
    # of French Copies:  "
    .$_POST['#_Copies_French'].
    Details/Comments:  "
    .$_POST['Details'].
    "

    "From: ".$_POST['Name']." <".$_POST['Email'].">"); 

    header("Location: http://www.wnstudios.ca/en/thankyou2.html");  
    exit();  

    ?>
    And the actual form is here: http://www.wnstudios.ca/en/order-commandez.html

    Any ideas? I can't find anything in the error log.

  2. #2
    Join Date
    Feb 2005
    Posts
    96
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It looks like a problem with your server... I didn't notice anything wrong with your mail script. I think it might be that php is not "talking" with your mail server. Make sure you are allowed to use mail().

    I have a home server where I can not use mail()

  3. #3
    Join Date
    Nov 2006
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    To test to see if you are allowed to use the mail() function try using this simple php/html contact script.

    (contact.html)
    Code:
        <form method="post" action="http://www.EXAMPLE.com/sendmail.php">
    		<div align="center" style="padding-left:10px">Name: <input name="name" type="text" /><br /></div>
    		<div align="center" style="padding-left:10px">Email: <input name="email" type="text" /><br /></div>
    		Message:<br />
    		<textarea name="message" rows="15" cols="40" style="border:#FFFF00 2px">
    		</textarea><br />
    		<input type="image" src="http://www.team330.org/images/go.png" />
    				</form>
    sendmail.php
    PHP Code:
    <?
      $email 
    $_REQUEST['email'] ;
      
    $message $_REQUEST['message'] ;
      
    $name $_REQUEST['name'] ;

      
    mail"EMAIL@exampl.com""$email",
        
    $message"From: $name);
      
    header"Location: http://www.team330.org/" );
    ?>

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Working for me as far as the redirect to thankyou2.html, but not sure about the mail part.

    Quote Originally Posted by TheBigT View Post
    I have a home server where I can not use mail()
    I too run a home server (as well as some others), and I have a mail server (application) running on my [home] server. If you would like one, I suggest downloading/installing hMailServer.


    EDIT: Sorry GT, cross posted.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    Nov 2006
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    No problem, its always cool to see other ways of fixing potential problems. Hopefully he can find a fix.

  6. #6
    Join Date
    Nov 2006
    Posts
    41
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    How do I expand the code to send more than just one field from a form? I have several fields of info that need to be sent.

    The pearl script I was using was working, but I was fiddlign this morning with the site and not I get the 500 Internal error again, so I don't know if it's something I did or my server. The server has had issues in the past.
    Last edited by eday_2010; 03-09-2007 at 06:25 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
  •