Dear All,
I've defined a variable $mnt which has the value of what i enter into a textbox named fdd_lot on Form 1
i.e. $mnt=$_POST['fdd_lot'];
I also have a second form on the same page as Form 1, namely Form 2 that contains a hidden input "submitted". So say I enter "xyz" into the text box then $mnt is assigned the value xyz and this is successfully shown on the page using the echo statement below.
However, when i try to insert $mnt into the database using the INSERT query it just inserts as a blank - the insert happens in as much as a new record is created but xyz doesn't appear in the "test" field. It's as if $mnt loses its value as soon as the submit button is clicked and Form 2 posted.
If I insert the statement $mnt='xyz'; just after the echo statement, then xyz is inserted into the test field in the database.
Does anyone have any idea why xyz is not showing in the test field?
<?php
echo ('the value is ').$mnt;
if (isset($_POST['submitted'])) {
$q1="INSERT INTO tbl_test (test) VALUES('$mnt')";
$r = mysqli_query($dbc,$q1);
}
?>