Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

StackOverflow Point

StackOverflow Point Navigation

  • Web Stories
  • Badges
  • Tags
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Web Stories
  • Badges
  • Tags
Home/ Questions/Q 185277
Alex Hales
  • 0
Alex HalesTeacher
Asked: June 9, 20222022-06-09T18:56:57+00:00 2022-06-09T18:56:57+00:00

html – Mysql not receiving new values from PHP code

  • 0

[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]

  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

Sidebar

Ask A Question

Related Questions

  • xcode - Can you build dynamic libraries for iOS and ...

    • 0 Answers
  • bash - How to check if a process id (PID) ...

    • 325 Answers
  • database - Oracle: Changing VARCHAR2 column to CLOB

    • 295 Answers
  • What's the difference between HEAD, working tree and index, in ...

    • 292 Answers
  • Amazon EC2 Free tier - how many instances can I ...

    • 0 Answers

Stats

  • Questions : 43k

Subscribe

Login

Forgot Password?

Footer

Follow

© 2022 Stackoverflow Point. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.