Edit button undefined table id

I have this code for an edit button:

<form method="post" action="pengiriman-input.php">
    <input type="hidden" name="id" value="<?php echo $row['id_transaksi']; ?>" />
    <input type="submit" value="Kirim" />
</form>

      

and in pengiriman-input.php

<?php 
session_start();

$_SESSION['id_transaksi'] = $_POST['idtransaksi']; ?>

      

but the result is:

Undefined index: idtransaksi in> C: \ xampp \ htdocs \ delivery \ pengiriman-input.php

How do I name the value $row['idtransaksi']

for pengiriman-input.php

?

$row['idtransaksi']

is a MySQL query.

+3


source to share


2 answers


Set up in the column name

as in your attribute name

it name='id'

, notidtransaksi

$_SESSION['id_transaksi'] = $_POST['idtransaksi'];
                                    ^^^^^^^^^^^

      

It should be



$_SESSION['id_transaksi'] = $_POST['id'];
                                    ^^^

      

or you can check it with either PHP isset function

$_SESSION['id_transaksi'] = (isset($_POST['id'])) ? $_POST['id'] : 0;

      

+2


source


It should be

$_SESSION['id_transaksi'] = $_POST['id'];

      



Since the name of your passed over a hidden field id

, not id_transaksi

.

+1


source







All Articles