Whats wrong with my Email Script?

Discussion in 'PHP' started by NITRO23456, Jul 6, 2009.

  1. #1
    Hi, please help!!

    the form:
    
    form method="post" action="sendmail.php">
      <table border="1" width="100%" cellspacing="0" bordercolor="#000000" cellpadding="0" bordercolorlight="#95A0C8" bordercolordark="#FFFFFF" bgcolor="#F9F9FA">
    	<tr>
    		<td><b><font size="2" face="Verdana">&nbsp;<br>
    &nbsp;Name: </font></b><br>
    &nbsp;<input name="name" type="text" size="27" /><br />
      &nbsp;<b><font size="2" face="Verdana">Organisation: </font></b>
    		<font face="Verdana" size="1">(e.g. )</font><br>
    &nbsp;<input name="organisation" type="text" size="27" /><br />
      &nbsp;<b><font size="2" face="Verdana">Phone Number:</font></b><br>
    &nbsp;<input name="phone" type="text" /><br />
      &nbsp;<font size="2" face="Verdana"><b>Position: </b></font>
    		<font face="Verdana" size="1">(e.g.)</font><br>
    &nbsp;<input name="position" type="text" size="28" /><br />
      &nbsp;<b><font size="2" face="Verdana">Email:</font></b><br>
    &nbsp;<input name="email" type="text" size="27" /><br />
      &nbsp;<b><font size="2" face="Verdana">Message:</font></b><br />
      &nbsp;<textarea name="message" rows="7" cols="29">
      </textarea><br />
      &nbsp;<input type="submit" />
    <br>
    &nbsp;</td>
    	</tr>
    	</table>
    	<table border="0" width="100%">
    		<tr>
    			<td width="35">&nbsp;</td>
    			<td>&nbsp;</td>
    		</tr>
    	</table>
    </form>
    
    Code (markup):
    the script:
    
    <?php
      $name = $_REQUEST['name'] ;
      $organisation = $_REQUEST['organisation'] ;
      $phone = $_REQUEST['phone'] ;
      $position = $_REQUEST['position'] ;
      $email = $_REQUEST['email'] ;
      $message = $_REQUEST['message'] ;
    
      mail( "xxxxxxx@hotmail.co.uk", "Contact Form",
    $name $organisation $phone $position      
    $message, "From: $email" );
      header( "Location: http://www.xxxxxxx.com/" );
    ?>
    
    Code (markup):
    at the moment it errors!
     
    NITRO23456, Jul 6, 2009 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    What are the errors ??
     
    Bohra, Jul 6, 2009 IP
  3. AODSolutions

    AODSolutions Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Mail method:
    mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

    you can contact me, I can help you.
     
    AODSolutions, Jul 6, 2009 IP
  4. www.amagit.com

    www.amagit.com Peon

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    <?php
      $name = $_POST['name'] ;
      $organization = $_POST['organization'] ;
      $phone = $_POST['phone'] ;
      $position = $_POST['position'] ;
      $email = $_POST['email'] ;
      $message = $_POST['message'] ;
    
      mail( "xxxxxxx@hotmail.co.uk", "Contact Form", "Name:$name \nOrganization:$organization \nPhone:$phone \nPosition:$position \nMessage:$message \n", "From: $email" );
      header( "Location: http://www.xxxxxxx.com/" );
    ?>
    Code (markup):
    This should fix it.

    Also... organization is spelled with a 'z' and you might want to fix that in the original form.
     
    www.amagit.com, Jul 6, 2009 IP
  5. anthonywebs

    anthonywebs Banned

    Messages:
    657
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #5
    
    <?php
      $name = $_POST['name'] ;
      $organization = $_POST['organization'] ;
      $phone = $_POST['phone'] ;
      $position = $_POST['position'] ;
      $email = $_POST['email'] ;
      $message = $_POST['message'] ;
    
      mail( "xxxxxxx@hotmail.co.uk", "Contact Form", "Name:$name \n Organization:$organization \nPhone:$phone\nPosition:$position \nMessage:$message \n", "From: $email" );
      header( "Location: http://www.xxxxxxx.com/" );
    ?>
    
    PHP:
     
    anthonywebs, Jul 6, 2009 IP
  6. anthonywebs

    anthonywebs Banned

    Messages:
    657
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You might have to put spaces after \n
     
    anthonywebs, Jul 10, 2009 IP