Forum Moderators: coopster
mysql_select_db("Office",$dbcon)or die("Sorry, the database is unavailable.<BR><BR>".mysql_error());
$result = mysql_query( "SELECT * FROM users WHERE name='$user'" );
$row = mysql_fetch_object($result);
<form action="update.php" method="post">
<select name="reports">
<? if ($row->Team1 == "1") {?> <option>Team1</option>
<? } if ($row->Team2 == "1") {?> <option>Team2</option>
<? } if ($row->team3 == "1") {?> <option>Team3</option>
<? }?>
</select><br>
<input type="button" name="Button1" value="Go" onClick="?"><br>
<?
$result2 = mysql_query( "SELECT * FROM weeklyinfo WHERE team='?'" );
$row2 = mysql_fetch_object($result2);
?>
Person1: <input type="text" name="week1" value="<? echo$row2->week1;?>"><br>
Person2: <input type="text" name="week2" value="<? echo$row2->week2;?>"><br>
<input type="Submit" value="Update">
</form>
Sorry, im new to php and getting in a right muddle. I may be going about this in the wrong way but basicaly im trying to make a page to update a mysql table but with a dropdown to retieve a certain row of data and enable me to update that row.
In the code above I have a drop down list (reports) that changes depending on the user logged on, this is working on my test page. But im not sure how to get the last two input fields to display the correct row of data depending on the drop down option. Also when the update button is hit, I need to update that same row.
Any help will be great! Thanx.