[ad_1]
I have created a test app on 000ebhost using PHP and HTML, while testing on localhost with XAMPP it was working, but when trying on the web host it is not creating new values any more…
Here’s the page:
<?php
include 'connection.php';
$get_products = "SELECT * FROM tb_products ";
$query_products = mysqli_query($conx, $get_products);
?>
<!doctype html>
<html lang="en">
<head>
<title>Products</title>
<script src="jquery-2.1.4.min.js"></script>
<script src="javascript.js"></script>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="wpriceth=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<!-- getting products to be shown on the html page -->
<table class="table">
<thead>
<tr>
<th>SKU</th>
<th> <!-- DELETING values -->
<button type="submit" form="del-form" class="btn btn-danger">
DELETE
</button>
</th>
<th>name</th>
<th>price</th>
<th>dvd MB</th>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<th>book Kg</th>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<th>dimension height, width, and length</th>
</tr>
</tr>
</tr>
</thead>
<thead>
<form action="delete.php" id="del-form" method="post">
</thead>
<tbody>
<!-- creating while instructions -->
<?php
while($getting_products = mysqli_fetch_array($query_products)) {
$id = $getting_products['id'];
$name = $getting_products['name'];
$price="$: " . $getting_products['price'];
$dvd = $getting_products['dvd'];
$book = $getting_products['book'];
$height = $getting_products['height'];
$width = $getting_products['width'];
$length = $getting_products['length'];
?>
<tr>
<td scope="row"><?php echo $id?></td>
<td> <!-- DELETE CHECKBOX -->
<form action="delete.php" method="POST">
<input
type="checkbox"
name="check_list[]"
value="<?php echo $id?>"
>
</td>
<td><?php echo $name?></td>
<td><?php echo $price?></td>
<td><?php echo $dvd?> MB</td>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><?php echo $book?> kg</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><?php echo $height?>cm</td>
<td><?php echo $width?>g</td>
<td><?php echo $length?>cm</td>
</tr>
</tr>
<?php }; ?> <!-- closing while -->
<!-- creating new values on the database -->
<hr>
<form action="create.php" method="POST">
<td><p class="position-absolute text-primary text-uppercase float-left">
Add a products
</p>
</td>
<tr>
<td></td>
<td></td>
<th>name</th>
<th>price</th>
<th>type</th>
<tr>
<td></td>
<td></td>
<td><input type="text" name="name" placeholder="Name"></td>
<td><input type="real" name="price" placeholder="$.$$"></td>
<td><input type="text" name="dvd" placeholder="DVD - MB"></td>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><input type="text" name="book" placeholder="Book - Kg"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><input type="text" name="height" placeholder="Dimentional - height"></td>
<td><input type="text" name="width" placeholder="Dimentional - width"></td>
<td><input type="text" name="lenght" placeholder="Dimentional - lenght"></td>
</tr>
</tr>
</tr>
<td><input class="btn btn-primary" type="submit" value="Add Product"></td>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
The connection is the usual values, and the create.php is here:
<?php
// open connection
include 'connection.php';
// receives typed data
$name = $_POST['name'];
$price = $_POST['price'];
$dvd = $_POST['dvd'];
$book = $_POST['book'];
$height = $_POST['height'];
$width = $_POST['width'];
$length = $_POST['length'];
// insert data on products table
$receives_products = "INSERT INTO
tb_products
VALUES ('','$name', '$price', '$dvd', '$book', '$height', '$width', '$length')";
// validates connection
$query_products = mysqli_query($conx, $receives_products);
// goes back to previous page
header('location: index.php');
?>
I don’t see anything wrong, so I hope someone can help me a little here.
[ad_2]