I have a form that populates related to what was answered in a previous question.
For example, question 1 has a list of 5 brands. I ask what % of each do you use in your business. The next page shows the list of brands that had an answer greater than "0" in question 1 along with their answers and another field to enter the answer to the next question. That is working fine. My problem is that when I go back to that page, I can't bring up the new answers from that page (Q2). They are saving in the MySql database OK but I don't know how to show them in the form field.
Below is my code.
HTML Code:
<tr>
<td width="20">
<?php
$Q1 = $_SESSION['Q1'];
$my_ansA = $Q1;
if ($my_ansA > 0)
{
echo "Brand A";
}
?>
</td>
<td width="97">
<div align="center">
<font face="Arial">
<?php
if ($my_ansA > 0)
{
echo $row['Q1'];
}
if ($my_ansA > 0)
{
echo "%";
}
?>
</font>
</div>
</td>
<td>
<div align="right">
<?php if ($my_ansA > 0) echo '<input type="text" name="Q2" /> '; ?>
<?php if ($my_ansA > 0) echo "%";?>
</td>
</tr>
I need to somehow show the value of Q2. Below is how I usually do it, but I can't put the php code into a php area.
HTML Code:
<input type="text" name="Q1" value="<?php echo $row['Q1']; ?>"
I've tried this . . .
PHP Code:
<?php if ($my_ansA > 0) echo '<input type="text" name="Q2" value="echo $row['Q2']">'; ?>
but get this error -Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'
I'd sure appreciate some help on this. Thanks!
|