kiranking 0 Newbie Poster

The process is as fallows
1. getwords.php which contains

  • two input text fields
  • submit button
  • results div

sends(post with ajax) the min and max integer value to do_search.php

2. do_search.php will process the post variable get the words from from database which as fields

  • eng_id
  • eng_text

then it is generating dynamic multiple forms. Two ways I am generating form which one is best or is it possible to make more simple.

method #1

foreach ($result as $myrow) {
$end_result .= '<form name=myform'.$myrow['eng_id'].' '.'id='.$myrow['eng_id'].' '.'method=post>
<input type=text name=da'.$myrow['eng_id'].' '.'id=knw'.$myrow['eng_id'].' '.'value='.$myrow['eng_text'].'>
<a hred=# class="perform" id=eng'.$myrow['eng_id'].'>One</a>
<a hred=# class="perform" id=engg'.$myrow['eng_id'].'>Two</a>
<a hred=# class="perform" id=del'.$myrow['eng_id'].'>Three</a></form>';
}
echo $end_result; // will be place in results div of getwords.php

method #2

foreach ($result as $myrow) {
$end_result2.= "<form name='myform".$myrow['eng_id']."' id='myform".$myrow['eng_id']."' method='post'>
<input type=text name='da".$myrow['eng_id']."' id='knw".$myrow['eng_id']."' value='".$myrow['eng_text']."' >
<a href='#' class='perform' id='eng".$myrow['eng_id']."'>One</a>
<a href='#' class='perform' id='engg".$myrow['eng_id']."'>Two</a>
<a href='#' class='perform' id='del".$myrow['eng_id']."'>Three</a>";
}
echo $end_result2; // will be place in results div of getwords.php
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.