troubleshooting Question

Inserting results of While loop to sql server

Avatar of peter Ojeda
peter Ojeda asked on
PHPSQL
5 Comments1 Solution148 ViewsLast Modified:
Hello experts, I am using the while loop below to populate a table with results from my sql server database. The while loop does its purpose of populating the table, but what I am attempting to do is pull the data from this php page to another php page where an update query is located.
I believe a better format for my question would be How to assign values to text inputs generated in a while loop
Below I am posting the code I am using to pull the data from php to populate the table, You can see I am populated text inputs(which is working) , but do not know how to assign a name to the text boxes after the first record is echo'd. I will provide an image to try to clear what I am saying up.

<table width="500" border="1" id="myTable">
  <tr>

    <th width="91" height="50"> <div align="center">DATE</div></th>
    <th width="91"> <div align="center">CREW</div></th>
    <th width="91"> <div align="center">SHIFT</div></th>
    <th width="91"> <div align="center">LINE</div></th>
    <th width="20PX"> <div align="center">#</div></th>
    <th width="91"> <div align="center">Light Station</div></th>
    <th width="91"> <div align="center">Packer</div></th>
    <th width="91"> <div align="center">Packer</div></th>
    <th width="91"> <div align="center">Packer</div></th>
    <th width="91"> <div align="center">Packer</div></th>
    <th width="91"> <div align="center">Palletizer</div></th>
    <th width="91"> <div align="center">Reliever</div></th>



  </tr>

<?php
while($result = sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC))
{
?>
  <tr>
	<td align="center"  height="50" width="120PX" nowrap> <?php if ($result["DATE"]!= NULL ){echo $result["DATE"] ->format("Y-m-d") ;}?></td>
	<td align="center" width="120px" height="50"  nowrap> <?php echo $result["CREW"];?></td>
	<td align="center" width="10px" height="50"  nowrap> <?php echo $result["SHIFT"];?></td>
	<td align="center" width="50px" height="50"  nowrap><INPUT TYPE="TEXT" NAME="LINE" VALUE=" <?php echo $result["LINE"];?>"></td>
	<td align="center" width="20px" height="50"  nowrap> <INPUT TYPE="TEXT" NAME="LINE_NUM" VALUE="<?php echo $result["LINE_NUM"];?>"></td>
	<td align="center" width="140px" height="50"  nowrap> <INPUT TYPE="TEXT" NAME="PERSON_1" VALUE="<?php echo $result["PERSON_1"];?>"></td>
	<td align="center" width="140px" height="50"  nowrap> <INPUT TYPE="TEXT" NAME="PERSON_2" VALUE="<?php echo $result["PERSON_2"];?>"></td>
	<td align="center" width="140px" height="50"  nowrap> <INPUT TYPE="TEXT" NAME="PERSON_3" VALUE="<?php echo $result["PERSON_3"];?>"></td>
	<td align="center" width="140px"height="50"  nowrap> <INPUT TYPE="TEXT" NAME="PERSON_4" VALUE="<?php echo $result["PERSON_4"];?>"></td>
	<td align="center" width="140px" height="50"  nowrap> <INPUT TYPE="TEXT" NAME="PERSON_5" VALUE="<?php echo $result["PERSON_5"];?>"></td>
	<td align="center" width="140px" height="50"  nowrap> <INPUT TYPE="TEXT" NAME="PERSON_6" VALUE="<?php echo $result["PERSON_6"];?>"></td>
	<td align="center" width="140px" height="50"  nowrap> <INPUT TYPE="TEXT" NAME="PERSON_7" VALUE="<?php echo $result["PERSON_7"];?>"></td>





  </tr>

<?php
}
?>
EXPERTEXCHEANGE.PNG
ASKER CERTIFIED SOLUTION
Peos John
Senior Technical Lead

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros