-3

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>

2 Answers2

0

There is an opening comment marker /* but it's never closed. To do so, just write */ where it should end.

However, as it doesn't seem that there is any comment, you could also remove tne /* completely.

StegSchreck
  • 320
  • 4
  • 18
0

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

hassan
  • 7,812
  • 2
  • 25
  • 36