elseif(isset($_GET['CaseID'])) {
$result = mysql_query("SELECT * FROM Cases WHERE CaseID='$_GET[CaseID]'");
while($r=mysql_fetch_array($result)) {
$CaseID1 = $r['CaseID'];
$PropertyID = $r['PropertyID'];
$Issue = $r['Issue'];
} ?>
<form method="post" action="" enctype="multipart/form-data" name="form1" id="form1">
<table width="500" border="0" cellpadding="0">
<tr>
<td width="30%" height="35">Property</td>
<td height="35"><select name="PropertyID" multiple size =6>
<?php
require("../includes/connection.php");
$result = mysql_query("select * from Properties");
while($r = mysql_fetch_array($result)) {
$id = $r["PropertyID"];
$StreetAddress = $r["StreetAddress"];
//echo "<option value = \"$id\">$StreetAddress</option>";
//echo "<option value=\"";
$sql = "select Cases.PropertyID as CaseID from Cases where Cases.CaseID = '$CaseID1'";
$echo = $sql["CaseID"];
echo "<option value= \"$id\">$StreetAddress $echo</option>\n";
}
?></select>
</td>
</tr>
<tr>
<td width="30%" height="35">Issue</td>
<td height="35"><INPUT TYPE="TEXT" NAME="Issue" VALUE="<?php echo $Issue1; ?>" size="60">
</td>
<input type="hidden" name="CaseID" value="<?php echo $CaseID1; ?>" />
</tr>
</table><br />
<INPUT TYPE="submit" name="submit" value="Update!">
</form>
<?php
}
As you can see, that's what I have at the moment. It grabs the CaseID from the url (like ?CaseID=1) and then generates the forms from that.
The problem I'm having is with the selection box thing - I want the current value of PropertyID from the Cases table where CaseID = 1... but I don't know how to get that
Note: The whole $sql = "bla bla bla" thing was me just trying to get the PropertyID. It didn't work.. only returns the letter s.
Hopefully that made some sense, if not, let me know and I'll try to explain it better! I'm not very good at PHP so I hope this isn't too terrible for a first attempt.