Hi all,
This is my first testing app in phpmyadmin with php code. But I am familiar with HTML ,CSS and Javascript. What I am facing now is the code of inserting is not working . However the connect to db code is working.
Thanks in advace
Here My Codes
1-connectToDB.php
Snippet
<?php $db_connect=mysqli_connect('localhost:3306 ','applesch','***','applesChatdb') or die ('Not Connected'); echo '<h2>DataBase Is Connected</h1>' ?>
2-TableCommands.php
<?php
   $dbhost = 'localhost:3306';
   $dbuser = 'applesch';
   $dbpass = '';
   $conn = mysql_connect($dbhost, $dbuser, $dbpass);
   if(! $conn ) {
      die('Could not connect: ' . mysql_error());
   }
   $value1 = $_POST['fname'];
   $value1 = $_POST['lname'];
   $value1 = $_POST['email'];
   $sql = "INSERT INTO users(fname, lname,email,reg_date)
      values(' $value1', '$value1',' $value1','$date')";
   mysql_select_db('applesChatdb');
   $retval = mysql_query( $sql, $conn );
   
   if(! $retval ) {
      die('Could not enter data: ' . mysql_error());
   }
   
   echo "Entered data successfully\n";
   
   mysql_close($conn);
?>
3-Index.php
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/                      bootstrap/4.4.1/css/bootstrap.min.css">
    </head>
    <body>
<?php
   include "connectToDB.php";
?>
     <div style="background-color: lightblue;padding: 20px;  font-size: large; display: inline-block; border: 2px solid navy; ">
     <h1>User's Information</h1>
         <form action="TableCommands.php" method="post">
    <table>
    <tr>
    <td><label >First Name:</label></td>
    <td><input type="text" name="fname" /></td>
    </tr>
    <tr>
    <td><label >Last Name:</label></td> 
     <td><input type="text" name="lname" /></td>
    </tr>
         <tr>
    <td><label >Email:</label></td>
    <td><input type="text" name="email" /></td>
    </tr>
</table>
  <input type="submit" value="Submit">
</form>   
</div>
    </body>
</html> 
      
     .
.