assiging variables on the fly
Posted: Fri Jun 13, 2003 7:22 pm
Hi There,
Ive had no trouble creating the tables and displaying the unit number beside the edit and remove buttons. Im not sure how to assign a value to each of the buttons as there created. I need to know which unit has been choosen, for my edit/remove page. I was able to do it with a drop down menu using $_POST but in time if the database grows displaying the units in a table would be a nicer approach. Thanks for any help.
Sincerley,
Lambert
Ive had no trouble creating the tables and displaying the unit number beside the edit and remove buttons. Im not sure how to assign a value to each of the buttons as there created. I need to know which unit has been choosen, for my edit/remove page. I was able to do it with a drop down menu using $_POST but in time if the database grows displaying the units in a table would be a nicer approach. Thanks for any help.
Sincerley,
Lambert
Code: Select all
<?php
function units_table()
{
$unit_query = "SELECT unit_id FROM unit WHERE owner_id = '" . $_SESSION['owner_id'] . "' ";
$unit_result = mysql_query($unit_query);
//count is for assigning a value to a button?
$count=0;
while($unit_entries = mysql_fetch_array($unit_result))
{
?>
<form name=owner_unit method=post action="room_editor.php">
<table width="24%" border="1" cellspacing="1" cellpadding="1">
<tr>
<td width="42%"><?php echo $unit_entries["unit_id"]; ?> </td>
<td width="24%">
<input type="hidden" name="unit_id" value="<? echo $unit_entries["unit_id"] ?>">
<input type="submit" name="Submit3" value="Edit"></td>
<td width="34%">
<input type="hidden" name="unit_id" value="<? echo $unit_entries["unit_id"] ?>">
<input type="submit" name="Submit4" value="Remove"></td>
</tr>
</table>
</form>
<?
$count++;
}
}
?>