0

I have the following, when the below code process', it gives me a list of ID's etc and Description and Subject. Now since there is a form i put within the loop, when i go to click on "View" button which then display only that specific "Ticket" the issue is, it always displays the same ticket. the last one in the array. why?

foreach ($results['results'] as $item) {
  echo 'Ticket ID # '. $item['id'] . ' Subject: '. $item['subject'] .'<br/>';
  echo 'Description : '. $item['description'] .'<br/>';
  echo "<form action=\"view.php\" method=\"post\">";
  echo '<input type="text" name="TicketID" value="'. $item['id'] .'"/>';
  echo "<input type=\"submit\" name=\"View\" value=\"View\" />";

  echo "<br>";
  echo "<br>";
}
2
  • What does var_dump($results['results']); show? Commented Feb 5, 2014 at 21:35
  • It shows the array in json_decoded form. Commented Feb 5, 2014 at 21:37

1 Answer 1

3

You do not close the <form> tag - simply add between the last <input> element and the <br> elements an echo '</form>'; line.

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

1 Comment

thank you . i think sometimes u just have to step away.. it took me all day =|

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.