Jump to content

why-My-Data-was-not-uploaded-in-the-Mysql-database(Connection.php)


Recommended Posts

<?php

$username="root";
$password="";
$server='localhost';
$db='crudyoutube';

$con=mysqli_connect($server,$username,$password,$db);

if($con){
    echo "Connection Successfull";
    ?>
    <script>
        alert("ok");
    </script>
<?php
}
else{
    die("no connection" . mysqli_connect_err());
}
?> 

 

(index.html)

<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .main {
      width: 900px;
      height: 500px;
      border-top: 5px solid black;
      border-bottom: 5px solid green;
      border-left: 5px solid red;
      border-right: 5px solid blue;
      transform: translate(300px, 250px);
      padding-left: 2px;
      margin-right: 16px;
      margin-bottom: 5px;
      text-shadow: 1px 0px 10px green;

    }

    .text {
      text-align: center;
      margin-top: 40px;
      font-size: 40px;

    }

    form {
      text-align: center;
    }

    b {
      font-family: Arial, sans-serif;
      font-size: 30px;
      padding-left: 22%;
      padding-top: 2%;
    }

    input {
      font-family: Arial, sans-serif;
      border-radius: 8px;
      height: 30px;
      width: 150px;
      padding: 5px 5px 5px 10px;
    }

    textarea {
      border-radius: 25px;
    }

    #btn {
      border-radius: 25px;
      background-color: rgb(9, 44, 243);
      width: 150px;
      height: 40px;
      font-size: 15px;
      cursor: pointer;
    }
  </style>
</head>

<body>

  <div class="main">
    <h2><b>Apply For Web Developer Post</b></h2><br>
    <form action="connection.php" method="post">
      
      &nbsp;&nbsp;<input type="text" class="fname" placeholder="Enter your name*" name="firstname">

      &nbsp;&nbsp;<input type="text" class="fname" placeholder="Enter your qualification*" name="quali"><br>

      &nbsp;&nbsp;<input type="text" class="fname" placeholder="mobile number*" name="moblie">

      &nbsp;&nbsp;<input type="text" class="fname" placeholder="email Id*" name="email"><br>
      <select id="Developer" name="developer">
        <option value="Web Developer">Web Developer</option>
        <option value="Android Developer">Android Developer</option>
        <option value="ios Developer">ios Developer</option>
      </select>
      &nbsp;&nbsp;<input type="text" class="fname" placeholder="Any References" name="ref"><br>

      &nbsp;&nbsp;<textarea name="text" id="tid" cols="30" rows="10" placeholder="Any Achievements*"></textarea><br><br>

      &nbsp;&nbsp;<input type="submit" class="btnres" id="btn" name="submit" value"Register"/>
    </form>


  </div>
  </body>
  
  </html>

 

Edited by Barand
code tags added

What we don't see are

  • check to see if data was posted to the page
  • data validation
  • an insert query to write the posted data to the database

(When posting code in these forums, use the code button "<>" in the toolbar.)

An interesting concept though. An input form pointed at a DB connection, at which point the DBAI interface takes over, processes the data, and updates the required tables for you. (MySQL v9.0 perhaps?)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.