php insert and display data

Solutions on MaxInterview for php insert and display data by the best coders in the world

showing results for - "php insert and display data"
Louis
02 Mar 2020
1<?php
2//including the database connection file
3include("config.php");
4if(isset($_POST['Submit'])) {    
5$pname = $_POST['pname'];
6$pcode = $_POST['pcode'];
7$pprice = $_POST['pprice'];
8        
9// checking empty fields
10if(empty($pname) || empty($pcode) || empty($pprice)) {                
11if(empty($pname)) {
12echo "<font color="red">Product Name field is empty.</font><br>";
13}
14if(empty($pcode)) {
15echo "<font color="red">Product Code field is empty.</font><br>";
16}
17if(empty($pprice)) {
18echo "<font color="red">Product Price  field is empty.</font><br>";
19}
20//link to the previous page
21 echo "<br><a href="javascript:self.history.back();">Go Back</a>";
22 } else { 
23// if all the fields are filled (not empty)             
24//insert data to database
25$result = mysqli_query($cser, "INSERT INTO crud2(pname,pcode,pprice) VALUES('$pname','$pcode','$pprice')");
26        
27//display success message
28echo "<font color="green">Data added successfully.</font>";
29        
30}
31}
32?>
33
queries leading to this page
php insert data into tableinsert and show data in phpphp insert into database and get datainsert data using insert value in phpget data insert phphow to insert data in phphow to inserrt data in phpinsert data into table phphow to insert data in table in phpphp insert data queryhow to insert data into sql and print data in phphow to insert data in table in sql using phpphp code for inserting data from datatble into database insert data in db using phpinsert data in sql using phpphp data insertget from data and insert into database phpinsert data into table sql phpdata insert query in phpinsert data into sql using phpinsert value in db from php how to insert value and show in sql phphow to print my php insert statementinsert data phpinsert data into table using phpinsert data in database using phpget and insert result phpphp show insert dataphp return insert dataphp inser data how to insert data in sql using phpinsert data in sql phpdata insert into database using phptable data insert using phpdata insert ini php oopphp code to insert data into databaseinsert sql data in phphow to insert data using phpinsert data with database using phpinsert data in database by phpinsrt data into the database in phpinsert data query in sql phpphp script to insert dataphp insert data then return the row instertedinsert data table in phpinsert data into database using phpinsert data sql with phpinsert data into sql table using phpdata insert in table phphow to insert data into table in sql using phpphp insert datahow insert data in database using phpinsert and view data in phpinsert data in sql with phpinsert data to db phpphp insert and display dataphp inset into dbinsert data in table in sql using phpisert table into table phpsercure way to insert php datainsert data in phpinsert data into database phpinsert the result value in database using phpinsert data in table in phpphp insert and display data