Jump to content

Need your help - very important


tomala90

Recommended Posts

Hi guys, anyone knows why do I keep getting a phrase errors? 

" Parse error: syntax error, unexpected '{' in /home/a7576050/public_html/email.php on line 30 "

 

Here is the code to my script

 

<?php
$to = "[email protected]";
$subject = "Invitation";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your email was sent"; }

f( isset($_REQUEST['email']) && isset($_REQUEST['message']) )
    {
        $email = $_REQUEST['email'];

        $message = $_REQUEST['message'];

        if($email == "" || $message == "")
        {

                echo "<br /><br />You did not fill out the form";

        }
?>

Link to comment
https://forums.phpfreaks.com/topic/179799-need-your-help-very-important/
Share on other sites

<?php
$to = "[email protected]";
$subject = "Invitation";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your email was sent"; }

if( isset($_REQUEST['email']) && isset($_REQUEST['message']) )
    {
        $email = $_REQUEST['email'];

        $message = $_REQUEST['message'];

        if($email == "" || $message == "")
        {

                echo "<br /><br />You did not fill out the form";

        }
}
?>

 

You forgotten to close your curly braces and one of your if statement you left out the "i".

That fixed the error phrase problem, but now I am getting something like this.  No matter if I put the information or no, I press "submit" it shows me that I did not fill out the form , and after this there are some weird symbols 

 

" ਍ℼⴭ眠睷〮〰敷桢獯⹴潣湁污瑹捩⁳潃敤ⴠ㸭਍猼牣灩⁴祴数∽整瑸樯癡獡牣灩≴猠捲∽瑨灴⼺愯慮祬楴獣栮獯楴杮㐲挮浯振畯瑮瀮灨㸢⼼捳楲瑰ാ㰊潮捳楲瑰㰾⁡牨晥∽瑨灴⼺眯睷栮獯楴杮㐲挮浯∯㰾浩⁧牳㵣栢瑴㩰⼯湡污瑹捩⹳潨瑳湩㉧⸴潣⽭潣湵⹴桰≰愠瑬∽敷⁢潨瑳湩≧⼠㰾愯㰾港獯牣灩㹴਍ℼⴭ䔠摮传⁦湁污瑹捩⁳潃敤ⴠ㸭਍ "

 

 

There should not be any problem with language.  I have a script that works but it is a simple one, and for example when some one do not fill out the form and hit submit I get an email from nobody, no email no message. So I am trying to avoid this by developing my scrip but I cant get it right

 

This is my simple script that works

 

<?php
$to = "[email protected]";
$subject = "Invitation";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "your email was sent"; }
else
{print "En error has occurred, try again , "; }
?>

There should not be any problem with language.  I have a script that works but it is a simple one, and for example when some one do not fill out the form and hit submit I get an email from nobody, no email no message. So I am trying to avoid this by developing my scrip but I cant get it right

 

This is my simple script that works

 

<?php
$to = "[email protected]";
$subject = "Invitation";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "your email was sent"; }
else
{print "En error has occurred, try again , "; }
?>

 

Easy.

 

Were are u getting $_REQUEST from ? lol

Try adding a Content-type header with a charset to the email.

 

E.g. like this:

<?php
$to = "[email protected]";
$subject = "Invitation";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email\r\nContent-type: text/plain; charset=utf-8";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "your email was sent"; }
else
{print "En error has occurred, try again , "; }
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.