i wanted to make the input type=text name="" to be incremental i.e. a1,a2,a3 according to the loops generated by sql query
the question is,how to specify which name to be read to the next page.code fragments might help better yeah?

in one of my .php script,i have this fragment of code:

if ($numrows == 0){
      echo "<br/>";	
      echo "<p align=\"center\">No one is using evaluation room</p>";

    }else {
	  echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"dsout.php\">";
	  echo "<table border=1 align=\"center\">";
	  echo "<tr> <th>Name</th> <th>PSC</th> <th>Room</th> <th>Time In</th><th>Time Out</th></tr>";
        while($row = mysql_fetch_array($results)){
	  echo "<tr>";
	  echo "<td> <input  type=\"text\" name=\"name\" size=\"10\" readonly=\"readonly\" value=";
	  echo $row['name'];
	  echo " \> </td>";
	  echo "<td> <input  type=\"text\" name=\"psc\" size=\"10\" readonly=\"readonly\" value=";
	  echo $row['psc_name'];
	  echo " \> </td>";
	  echo "<td> <input  type=\"text\" name=\"room\" size=\"10\" readonly=\"readonly\" value=";
	  echo $row['room'];
	  echo " \> </td>";
	  echo "<td> <input  type=\"text\" name=\"time\" size=\"10\" readonly=\"readonly\" value=";
	  echo $row['time_in'];
	  echo " \> </td>";	
	  echo "<td align=\"center\"><input  type=\"submit\" name=\"upload\" class=\"box\" value=\"Out\" /></td> ";	
	  echo "</tr>";
          echo "<br />";
	  echo "</table>";
	  echo "</form>";

at this fragment of code,i can't assign the names to be incremental.i tried using name=\"name.$i.\" and name=\"name\".$i.\"\",both have no effect,i echoed in the next fragment of code to see the effect.

in dsout.php file,i have this fragment of code:

require_once "connection.php";
echo $name;
$query = "update atrack set time_out=current_timestamp()".
"where name='$name'";

mysql_query($query) or die('Error, query failed');

echo "User signed out from using evaluation room";

as you can see,without the incremental method, the echo $name will take the last row of result from the 1st fragment of code.when i tried the incremental method onto the 1st fragment, echo $name0,$name1 wont take any effect.
but the real question lies here,how can i code the files,when at the 1st fragment,i clicked on the submit button,it will pass base on the incremental name?i.e. if i click submit at the 2nd row, name1/name2 (based on the initialization) will be passed to dsout.php?

this post is too long,tq for your time reading^^

8 Years
Discussion Span
Last Post by keanoppy

problem solved by me >.<
tq to those who have read the post


btw,i solved the problem by indexing the button i want to click,then i set the button values as $i,based on each indexing
on the other page, i used

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.