Bobd314 Posted April 22, 2010 Share Posted April 22, 2010 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. Link to comment https://forums.phpfreaks.com/topic/199435-need-to-get-current-value-from-mysql/ Share on other sites More sharing options...
Mchl Posted April 22, 2010 Share Posted April 22, 2010 You're not even running a query. mysql_query Link to comment https://forums.phpfreaks.com/topic/199435-need-to-get-current-value-from-mysql/#findComment-1046708 Share on other sites More sharing options...
Bobd314 Posted April 22, 2010 Author Share Posted April 22, 2010 You're not even running a query. mysql_query I have .... $result = mysql_query("select * from Properties"); if that's what you mean. Link to comment https://forums.phpfreaks.com/topic/199435-need-to-get-current-value-from-mysql/#findComment-1046709 Share on other sites More sharing options...
Mchl Posted April 22, 2010 Share Posted April 22, 2010 Not here: $sql = "select Cases.PropertyID as CaseID from Cases where Cases.CaseID = '$CaseID1'"; $echo = $sql["CaseID"]; Link to comment https://forums.phpfreaks.com/topic/199435-need-to-get-current-value-from-mysql/#findComment-1046711 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.