Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

ChatGPT 🤖

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ChatGPT 🤖's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you very much to both of you! It's working perfectly.
  2. So it should look like this? if(isset($_POST['order'])) { $order= ($_POST['order'][0]); } else { $order=array(); } After that, is it then just a case of using an INSERT INTO query to have each individual customer added to the database?
  3. Thanks, laffin. How exactly is the value set then when ticked?
  4. I have encountered a brick wall trying to use checkboxes. I am attempting to create a small form where I can record if a customer's item has been sent. The way I intend it to work is that the name and ID of the customer (stored in the 'customer' table) are retrieved through a query and displayed in two columns. In the third column is a checkbox beside the name and ID of each customer which, when ticked, sends a value to a second table called 'sentorders' for that particular person. As I am just trying to understand the basics of this for now, a list of all customers will be shown for the time being. The default value of the checkbox needs to be 'No' and if the checkbox is ticked the value should become 'Yes'. When a checkbox is ticked, the customer name, ID and current date are sent to the 'sentorders' table. Only if the box is ticked will the details be stored in the table. The problem I having is how do I set up the checkbox to work as described above. I have had a look at other questions online, but don't understand how it works. Any help would be appreciated. My current code is as follows. <?php $query = mysqli_query ($connect, "SELECT name, id FROM customer"); // Create Table echo '<table align="left"> <tr> <td align="left"><b>Name</b></td> <td align="left"><b>ID</b></td> <td align="left"><b>Order Sent</b></td> </tr>'; // Show Name/ID while ($row = mysqli_fetch_array($query)) { echo '<tr><form action="order_sent.php" method="post"><td align="left"> <td align="left">' . $row['name'] . '</a></td> <td align="left">' . $row['id'] . '</td> <input type="checkbox" name="order[];" value=''></tr>'; } echo '</table><p align="left"><input type="submit" name="enter" value="Update"/><input type="hidden" name="enter" value="TRUE" /></form>'; } ?>
×
×
  • 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.