Upon clicking to this page, I am able to edit most of the details in here, but all of the companies were listed to allow the editing of data.
WHAT IS NEEDED: Page A: "Clicked on Company A's edit details" Page B "Show only the edit entries for Company A"
WHAT IS ACTUALLY SHOWN IN THE CODES BELOW: Page A: "Clicked on Company A's edit details" Page B: "Shows all the edit entries for all the companies in the database"
I believe that I should not be using a while loop but since I'm getting here from another page, I would probably need to use a if/else statement to check for it.
In the list to be clicked:
<!-- popup -->
<div data-role="popup" id="popupMenu">
<ul data-role="listview" data-inset="true" >
<li data-role="divider" data-theme="a">Choose Action</li>
<li><a href="editCompany.php?id=<?php echo $row[$company_id]; ?>">Edit Details</a></li>
<li><a href="#">View Jobs</a></li>
</ul>
</div>
AND in the edit page:
<?php
if ($totalCompanies > 0) {
?>
<?php
while ($row = mysqli_fetch_assoc($result)) {
//$id = $row['id'];
$company_id = $row['company_id'];
$company_name = $row['company_name'];
$business_regno = $row['business_regno'];
$address = $row['address'];
$contact_num = $row['contact_num'];
$contact_name = $row['contact_name'];
?>
<form id="editCompany" action = "doCreateCompany.php" method = "post">
<label id="company_name">Company Name: </label>
<input type="text" name="company_name" id="company_name" value="<?php echo $company_name ?>">
<label id="business_regno">Business Registration Number: </label>
<input type="text" name="business_regno" id="business_regno" value="<?php echo $business_regno ?>">
<label id="address">Address: </label>
<input type="text" name="address" id="address" value="<?php echo $address ?>">
<label id="contact_num">Contact Number: </label>
<input type="text" name="contact_num" id="contact_num" value="<?php echo $contact_num ?>">
<label id="contact_name">Contact Name: </label>
<input type="text" name="contact_name" id="contact_name" value="<?php echo $contact_name ?>">
<input type="submit" data-theme="b" data-inline="true" value="Save Company Details"/>
</form>
<?php
} // end for loop
?>
<?php
} //end if
mysqli_close($link);
?>
</div>
Thanks so much!