My PHP code is not working when I add HTML code to it ? And this error keep displaying ("Parse error: syntax error, unexpected end of file")?

Isra M. Radwan

Any help please, I got a problem in my php and html code they don't work together, they only work individually and this Error keep displaying every time I rerun the code, ("Parse error: syntax error, unexpected end of file"), I tried to change the location of php code in the html but nothing happened, also this is what I got in http.conf file and I don't know how to edit it to work properly:-

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    AddEncoding x-compress .Z
    AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php3

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>`enter code here`

and this is my code of php and html:

signup.php

<html>
<body>
<div class="form">
        <ul class="tab-group">
        <li class="tab active"><a href="#signup">Sign Up</a></li>
        <li class="tab"><a href="#login">Log In</a></li>
      </ul>

      <div class="tab-content">
        <div id="signup">   
          <h1>Sign Up for Free</h1>

          <form action="/" method="post">

          <div class="top-row" >
            <div class="field-wrap">
              <label>
                First Name<span class="req">*    </span>
              </label>
              <input type="text" required autocomplete="off" name = "firstname"/>
            </div>

            </br>

            <div class="field-wrap" >
              <label>
                Last Name<span class="req">*     </span>
              </label>
              <input type="text"required autocomplete="off" name = "lastname"/>
            </div>
          </div>

          </br>

            <div class="field-wrap" >
               <label>
               User name<span class="req">*</span>
               </label>
               <input type="text"required autocomplete="off" name = "username"/>
            </div>

            <div class="field-wrap" >
               <label>
               Residence<span class="req">*   </span>
               </label>
               <input type="text"required autocomplete="off" name = "Residence"/>
            </div>


          </br>

          <div class="field-wrap" >
            <label>
              Phone Number <span class="req">*</span>
            </label>
            <input type="phone"required autocomplete="off" name = "phone num"/>
          </div>

          </br>

          <div class="field-wrap" >
            <label>
              Email Address<span class="req">*</span>
            </label>
            <input type="email"required autocomplete="off" name = "email"/>
          </div>

          </br>

          <div class="field-wrap" >
            <label>
              Set A Password <span class="req">*</span>
            </label>
            <input type="password"required autocomplete="off" name = "pass"/>
          </div>
          </br>
          <button type="submit" class="button button-block"/>Get Started</button>

          </form>       
<?php
//require_once 'android_login_api/include/Config.php';

define("Server_name", "localhost");
define("DB_username", "root");
define("DB_password", "");
define("DB_name", "aqar");
$conn = mysqli_connect(Server_name,DB_username,DB_password,DB_name);
if (!$conn):
   echo "connection is successful";
else:
   echo "connection is not successful";

if(isset($_POST['firstname']) && isset($_POST['lastname']) ){ 

    // receiving the post params

    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];


    $insert = "INSERT INTO userstable(FirstName, LastName) 
                       VALUES($firstname,$lastname)";

$result = mysqli_query($conn ,$insert);}
else {
die ("error is: " . mysql_error()); }

?>

</div><!-- tab-content -->

</div> <!-- /form -->
</body>
</html>
hassan

there are typo in your if condition syntax

if (!$conn):
   echo "connection is successful";
else:
   echo "connection is not successful";

you must close your condition as follows

if (!$conn):
   echo "connection is successful";
else:
   echo "connection is not successful";
endif;

check out if/elseif/else

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

I receive the following error ReferenceError: document is not defined when running my html code in Cloud 9

From Dev

How come nothing is appearing when I add if statements to my PHP code?

From Dev

My Code is not working as I expected

From Dev

My PHP code is not working?

From Dev

Parse error: syntax error, unexpected end of file

From Dev

How do I add an HTML code to my website so that when people click it, it opens a WhatsApp conversation with me?

From Dev

Parse error: syntax error, unexpected end of file wordpress theme

From Dev

My php Table code is not working

From Dev

I keep getting an "illegal start of expression" error on my code

From Dev

When i add this code in workbook received an error

From Dev

Parse error: syntax error, unexpected end of file on line 115

From Dev

My PHP code is not working properly

From Dev

PHP Code not displaying Like same HTML code

From Dev

PHP Parse error: syntax error, unexpected end of file, expecting '`'

From Dev

How can I put this php code(if condition) in my html code?

From Dev

My code is not working properly when I attempt to login

From Dev

Parse error: syntax error, unexpected end of file on localhost

From Dev

Parse error: syntax error, unexpected end of file in line 13

From Dev

I keep on getting the error "java.util.InputMismatchException" in my code

From Dev

Issue with displaying PHP code in HTML

From Dev

Parse error: syntax error, unexpected end of file in

From Dev

Parse error: syntax error, unexpected end of file in line 179 (file doesn't have so many lines)

From Dev

PHP - Parse error: syntax error, unexpected end of file

From Dev

My PHP code is not working?

From Dev

My php Table code is not working

From Dev

PHP: Parse error: syntax error, unexpected end of file

From Dev

"Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\trial\register.php on line 104

From Dev

Error when I building my code

From Dev

I'm getting Parse error: syntax error, unexpected end of file

Related Related

  1. 1

    I receive the following error ReferenceError: document is not defined when running my html code in Cloud 9

  2. 2

    How come nothing is appearing when I add if statements to my PHP code?

  3. 3

    My Code is not working as I expected

  4. 4

    My PHP code is not working?

  5. 5

    Parse error: syntax error, unexpected end of file

  6. 6

    How do I add an HTML code to my website so that when people click it, it opens a WhatsApp conversation with me?

  7. 7

    Parse error: syntax error, unexpected end of file wordpress theme

  8. 8

    My php Table code is not working

  9. 9

    I keep getting an "illegal start of expression" error on my code

  10. 10

    When i add this code in workbook received an error

  11. 11

    Parse error: syntax error, unexpected end of file on line 115

  12. 12

    My PHP code is not working properly

  13. 13

    PHP Code not displaying Like same HTML code

  14. 14

    PHP Parse error: syntax error, unexpected end of file, expecting '`'

  15. 15

    How can I put this php code(if condition) in my html code?

  16. 16

    My code is not working properly when I attempt to login

  17. 17

    Parse error: syntax error, unexpected end of file on localhost

  18. 18

    Parse error: syntax error, unexpected end of file in line 13

  19. 19

    I keep on getting the error "java.util.InputMismatchException" in my code

  20. 20

    Issue with displaying PHP code in HTML

  21. 21

    Parse error: syntax error, unexpected end of file in

  22. 22

    Parse error: syntax error, unexpected end of file in line 179 (file doesn't have so many lines)

  23. 23

    PHP - Parse error: syntax error, unexpected end of file

  24. 24

    My PHP code is not working?

  25. 25

    My php Table code is not working

  26. 26

    PHP: Parse error: syntax error, unexpected end of file

  27. 27

    "Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\trial\register.php on line 104

  28. 28

    Error when I building my code

  29. 29

    I'm getting Parse error: syntax error, unexpected end of file

HotTag

Archive