-2
<?php include 'connection.php'; ?>
<?php
if (isset($_GET['consultation']))
{
    echo "Consultation Details";
    $no=$_GET['consultation'];
    ?>

    <form class="" method="get">
        <textarea name="details" rows="8" cols="80" placeholder="enter consultation details"></textarea><br>
        <button type="submit" name="c">submit</button>
    </form>

    <?php
    if (isset($_GET['details'])) {
        $details=$_GET['details'];
    }
    //$details= $_GET['details'];
    $insertQuery="INSERT INTO redo (consultation) VALUES ($details) WHERE no=$no;";
    $insert = mysqli_query($conn,$insertQuery);

    if ($insert) {
        echo "recorded";
        ?>
        <a href="display.php">Back to Total Patients</a>
        <a href="index.php">Back to Registration</a>
        <?php
    }
    else {
        echo "record couldnt be inserted";
    }
}
?>
Dharman
  • 30,962
  • 25
  • 85
  • 135
rangerboyy
  • 185
  • 2
  • 10

1 Answers1

-1

No $_GET['details'], you sure you're using a GET method in the form? Change $_GET['details'] to $_REQUEST['details'].

To be exact, this one fails:

if (isset($_GET['details'])) {
    $details=$_GET['details'];
}

I mean, the if condition is not met, so $details is not defined, as you don't define it anywhere in the code outside that if.

Other solution would be adding:

$details = '';

in front of that if.

Flash Thunder
  • 11,672
  • 8
  • 47
  • 91