Jump to content


PHP Mail function


3 replies to this topic

#1 mexican0

    Young Padawan

  • Members
  • Pip
  • 7 posts

Posted 20 August 2007 - 06:11 AM

This is my HTML Code:

<form action="contact_send.php" method="post" name="form">
<input name="doel" type="radio" value="opnemen">
<input name="doel" type="radio" value="brochure">
<input name="doel" type="radio" value="afspraak1">
<input name="doel" type="radio" value="afspraak2">
<input name="bedrijfsnaam" class="textarea" type="text" size="35" maxlength="55">
<input name="contactpersoon" class="textarea" type="text" size="35" maxlength="55">
<input name="adres" class="textarea" type="text" size="35" maxlength="55">
<input name="postcode" class="textarea" type="text" size="7" maxlength="7">
<input name="plaats" class="textarea" type="text" size="35" maxlength="55">
<input name="telefoon" class="textarea" type="text" size="20" maxlength="23">
<input name="email" class="textarea" type="text" size="35" maxlength="40">
<textarea name="opmerking" class="textarea" cols="75" rows="8"></textarea>
<input type="submit" class="buttons" value="Verstuur">&nbsp;<input type="reset" class="buttons" value="Reset">

And here is the contact_send.php where the form in the HTML is responding to..

<?php
// Contact subject
$name = $_POST['name']; 
$company = $_POST['company'];
$email = $_POST['email'];
$homepage = $_POST['homepage'];
$comment = $_POST['comment'];
$ip = $_SERVER['REMOTE_ADDR'];
$subject="CGFX-ContactForm";
$message="
E-Mail sent by: $name\n
E-Mail address of him/her: $email\n
Company: $company\n
Sender his/her IP: $ip\n
---------------------------------------------------------\n
His/Her Comment: $comment"; 

// Mail of sender
$mail_from="$email"; 
// From 
$header="from: $name <$email>"; 

// Enter your email address
$to [email="="]='peters_niek@hotmail.com'[/email]; 

$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email 
// display message "We've recived your information"
if($send_contact){
header('Location: sended.php');
}
else {
header('Location: errorform.php');
}
?>

When I fill in the form i get this error:

Parse error: parse error, unexpected T_VARIABLE in /home/httpd/vhosts/goemba.nl/httpdocs/contact_send.php on line 31

Line 31 is the line with: $send_contact=mail($to,$subject,$message,$header);

I really hope you guys can help me out!!

Edited by mexican0, 20 August 2007 - 06:16 AM.


#2 .CJ

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Leeds, UK

Posted 20 August 2007 - 07:40 AM

I think your problem referees to this line

// Enter your email address
$to [email="="]='peters_niek@hotmail.com'[/email];

Looks wrong to me... what's with the [email] things?

Try

$to = 'EMAIL ADDRESS';


#3 nitr0x

    Young Padawan

  • Members
  • Pip
  • 201 posts

Posted 21 August 2007 - 02:05 PM

Yea I agree with CJ, just try it like that.

$to = 'peters_niek@hotmail.com';


#4 mexican0

    Young Padawan

  • Members
  • Pip
  • 7 posts

Posted 26 August 2007 - 09:44 AM

thanks, about the strings that's done by the site.. it's not like that in my php code..

anywayz thanks all i found the problem.. i just forgot some ; somewhere..





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users