0

This is my code. Unfortunately this causes a parse error. Can anyone think of a better way to do this?

$data = mysqli_query($link, "SELECT * FROM TreatmentTypes ORDER BY TreatmentType ASC");
while($row = $data->fetch_assoc())
{
    $str = row['TreatmentTypeID'];
    echo "<br><br><br>".$_POST['txt'.$str];
}
4
  • You probably want to use variable variables. php.net/manual/en/language.variables.variable.php Commented Feb 19, 2014 at 17:03
  • You have to set same name in html form for that value. Commented Feb 19, 2014 at 17:04
  • why $_POST[]; for variable on same page? directly echo $str; Commented Feb 19, 2014 at 17:05
  • You are missing $ at the beginning of row['TreatmentTypeID']; -> $str = row['TreatmentTypeID']; Commented Feb 19, 2014 at 17:05

1 Answer 1

3

Judging by your sample you are missing an $ in row['TreatmentTypeID']; so it should be $row['TreatmentTypeID'];

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.