Click here to Skip to main content
16,021,810 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am a student trying php. pls help me out i am confused
this is the code i typed:
PHP
<?php
$emailErr = "" ;
$email = "" ;
$error = 0 ;
if ($_SERVER ["REQUEST_METHOD"] == "POST") 
{
    if (empty($_POST["email"] ) ) 
    {
        $emailErr = "email is required" ;
        $errors = 1 ;
    }
    else
    {
        $email = test_input ($_POST["email"] ) ;
        if ( !filter_var ($email, FILTER_VALIDATE_EMAIL) )
        {
            $emailErr = "invalid email format" ;
            $errors = 1 ;
        }
    }

    function test_input ($data)
    {
        $data = trim($data) ;
        $data = stripslashes ($data) ;
        $data = htmlspecialchars ($data) ;
        return $data ;
    }
?>


<title> my website 


<h1 align=" center "> Login </h1>
" >
 EMAIL ID  
<span class="error">*<?php echo $emaiErr ; ?> </span> 
<br>
 PASSWORD 
<br>
<br>

<?php
if ( isset ( $_POST[ 'submit' ] ) && (errors == 0) )
{
    echo "<h2> Form submitted successfully.</h2>" ;
}
?>


What I have tried:

i have tried nothing as of now except for trying to change syntax but here i don't understand what to do.. pls help me out and also pls mention if there is a problem with the html part too.. thank you
Posted
Updated 27-Sep-18 21:15pm
v2

1 solution

If you indent your code properly (as I have done for you), you can clearly see there is a closing brace missing from your initial if statement.
 
Share this answer
 
Comments
Member 14000568 28-Sep-18 3:52am    
sir i tried it out and now it shows "Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\ma1.php on line 49".. thank you for the help but pls help me out again
[no name] 28-Sep-18 4:16am    
Look at the text below the <title> tag in your HTML. What is the line that begins " > supposed to mean? Please make an effort actually to read through your code.
Member 14000568 28-Sep-18 5:37am    
thank u sir i realized my mistake

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900