0 votes
in Education by (1.7m points)
Why it doesn't display POST value?

Error: Notice: Undefined index: q[abc] in line: echo $_POST['q[abc]'];

Thanks!

<form method="POST" action="post.php" name="tq">

    <input type="hidden" name="q[id]" value="1035">

    <input type="radio" name="q[abc]" value="3001"></div>

    <div>A</div>

    <input type="radio" name="q[abc]" value="3002"></div>

    <div>B</div>

    <input type="radio" name="q[abc]" value="3003"></div>

    <div>C</div>

    <input type="submit" name="add" value="Next">

</form>

<?php

if (isset($_POST['add'])) {

    echo $_POST['q[abc]']; //error line

}

?>

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by (1.7m points)
Instead of echo $_POST['q[abc]']; you should try echo $_POST['q']['abc'];
...