Possible Duplicate:
“Cannot use string offset as an array” error
<?php
$marks = 0;
$total = $_POST["lines"];
$quesA = $_POST["ques"];
$quesNo = 1;
$opt = array("","A","B","C","D");
for ($i = 0; $i < $total; $i++)
{
$q = $quesA[$i][0]; // here error
...
Here I assign $quesA = $_POST["ques"]; now it take a variable $q = $quesA[$i][0]; then print in line
echo "<div><b style='color:red;'>Q" . $quesNo . " : </b>"
. "<span style='color:blue;'>" . $q ."</span></div>"
;
here is my code: https://dl.dropbox.com/u/24972447/onlineQuiz.7z
The problem is that
$quesA[$i]is not a valid array and you are trying to use it like an array.Am not sure how you are getting
$_POST["ques"]but you need to make sure its an array before you can access it.Post what you are expecting from
$_POST["lines"]&$_POST["ques"];i may be able to help further