The setup is basically like this:
Page 1: the user enters some text data into textareas in a php-generated HTML form.
Page 2: php REQUESTs the data entered on the previous page. Then the user goes on to enter more data in a new form.
And then there are many more similar pages.
Here is the relevant code in the first page:
(The 3 variables $next_ques_link, $queswork, and $quesanswer are used on every page, their values being set at the top of the page before the above form is reached. On the first page, $queswork and $quesanswer are set to "ques1work" and "ques1answer" respectively. Different values are used on the second page.)<form id=amt_contform method=POST action=<?php echo $next_ques_link ; ?> >
<table border='1'>
<tr><td rowspan=2><p>Show your work here.</p>
<textarea name=<?php echo $queswork ; ?> id=<?php echo $queswork ; ?> rows=20 cols=30></textarea></td>
<td valign="top"><p>Write your final answer here.</p>
<textarea name=<?php echo $quesanswer ; ?> id=<?php echo $quesanswer ; ?> rows=1 cols=10></textarea></td>
<tr><td valign="top"><p>Click "Next" when you are finished.</p>
<input id=SubmitButton type=submit name=Next value=Next ></td></tr>
</table>
Both pages REQUIRE a page called data_processing.php. This file is responsible for REQUESTING all data entered so far. It does so by creating an array of strings using the question names as keys, with default values of "blank". It then uses REQUEST to instantiate the values of all variables (though obviously this will only work for the variables which have been entered so far.) Here's the relevant code:
To reiterate, my problem is that only part of the data from the first page gets successfully passed to the second page. For example, if I enter$ques_data_arr = array(
'ques1work' => "blank",'ques1answer' => "blank",
'ques2work' => "blank",'ques2answer' => "blank",
...);
foreach ($ques_data_arr as $qname => $qdata) {
$ques_data_arr[$qname] = $_REQUEST[$qname];
}
"Line 1
Line 2
Line 3"
into the first text box on the first page, once I get to the second page, the value of ques1work will be
"Line"
as I have verified by using Javascript to display the value of that variable when the second page runs.
Any idea what I'm doing wrong and how I can get the entire block of data entered on the first page to pass successfully? Thanks very much in advance!!