Chatbox

You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1 what error? on 16/4/2012, 4:53 pm

grimofdoom

avatar

Member
i have this code i found
Code:
<?php
  {$name = $_POST['name'];
  $visitor_email = $_POST['email'];
  $message = $_POST['message'];

    $email_from = 'mail@mail.mail';
    $email_subject = "test";
    $email_body = "You have received a new message from the user $name.\n".
                            "Here is the message:\n $message".;}
?>
to send a message from contact us page.but when i do this,it comes up with error on line 8-10.i have some basic information on php but can't find the problem.

View user profile

2 Re: what error? on 16/4/2012, 5:25 pm

Vanilla990

avatar

Administrator
Have you set up a html form to collect the information for the email?

It will also encounter an error when it gets to 'mail@mail.mail' as that's an invalid email address.

View user profile

3 Re: what error? on 16/4/2012, 5:31 pm

grimofdoom

avatar

Member
i know its an invalid email because i had my email and i didnt get spammed. then there is a html form
Code:
<form method="post" name="myemailform" action="http://animereject.hostei.com/send.php">
Enter Name: <input type="text" name="name"><br>
Enter Email Address:    <input type="text" name="email"><br>
Enter Message:  <textarea name="message"></textarea><br>
<input type="submit" value="Send Form">
</form>

View user profile

4 Re: what error? on 16/4/2012, 11:57 pm

LGforum

avatar

Moderator
Where are you getting these codes from? Razz

Your error is this bit: "Here is the message:\n $message".

Its just a random string in the middle of the code...
There's also no reason for the PHP to be incased in curly brackets.

View user profile

5 Re: what error? on 18/4/2012, 4:03 pm

grimofdoom

avatar

Member
i gt rid of the line but still error.guess ill jsut put this to the side for now since i have another css problem

View user profile

6 Re: what error? on 18/4/2012, 6:08 pm

LGforum

avatar

Moderator
Well what does the error say..?

View user profile

7 Re: what error? on 18/4/2012, 7:39 pm

grimofdoom

avatar

Member
"Parse error: syntax error, unexpected ';' in /home/a2195800/public_html/send.php on line 8"

View user profile

8 Re: what error? on 19/4/2012, 12:30 pm

Vanilla990

avatar

Administrator
I'm going to guess a bit and say it has something to do with the full stop and semi-colon on this line:

Code:

$email_body = "You have received a new message from the user $name.\n".
                            "Here is the message:\n $message".;}

View user profile

9 Re: what error? on 20/4/2012, 5:25 pm

LGforum

avatar

Moderator
That is also an error... but there's load of errors in it...

Swap it all for this:
Code:

<?php
  $name = $_POST['name'];
  $visitor_email = $_POST['email'];
  $message = $_POST['message'];

    $email_from = 'mail@mail.mail';
    $email_subject = "test";
    $email_body = "You have received a new message from the user $name. \nHere is the message:\n $message. ";
?>

Your biggest issue was having that random string flailing about. Also, when you use '\n' for a new line, you don't actually need to put a new line within your string... unless you get two new lines.

One of biggest benefits of PHP strings is you don't have to specify new lines with the \n meta character.

View user profile

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum