what error?
Page 1 of 1 • Share
- grimofdoomMember
- Forum Posts : 106
Member Since : 2012-03-06
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".;}
?>
- Vanilla990Administrator
- Forum Posts : 114
Member Since : 2011-10-30
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.
It will also encounter an error when it gets to 'mail@mail.mail' as that's an invalid email address.
- grimofdoomMember
- Forum Posts : 106
Member Since : 2012-03-06
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>
- LGforumModerator
- Forum Posts : 77
Member Since : 2011-11-12
Where are you getting these codes from?
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.
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.
- grimofdoomMember
- Forum Posts : 106
Member Since : 2012-03-06
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
- LGforumModerator
- Forum Posts : 77
Member Since : 2011-11-12
Well what does the error say..?
- grimofdoomMember
- Forum Posts : 106
Member Since : 2012-03-06
"Parse error: syntax error, unexpected ';' in /home/a2195800/public_html/send.php on line 8"
- Vanilla990Administrator
- Forum Posts : 114
Member Since : 2011-10-30
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".;}
- LGforumModerator
- Forum Posts : 77
Member Since : 2011-11-12
That is also an error... but there's load of errors in it...
Swap it all for this:
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.
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.
- Sponsored content
Similar topics
Create an account or log in to leave a reply
You need to be a member in order to leave a reply.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|