How to use a form variable to determine recordset values
I have the following recordset that is used to display values on a page and also use in a hidden form field.
$FormAccID_rsAccSelected = "-1";
if (isset($_POST['members_id'])) {
$FormAccID_rsAccSelected = $_POST['members_id'];
}
mysql_select_db($database_RTMFadmin, $RTMFadmin);
$query_rsAccSelected = sprintf("SELECT rtm_companies.members_id, rtm_companies.company_name, rtm_companies.company_number, federation_properties.estate_name_p, members.first_name, members.surname FROM rtm_companies INNER JOIN federation_properties ON rtm_companies.members_id = federation_properties.members_id INNER JOIN members ON rtm_companies.members_id = members.members_id WHERE rtm_companies.members_id = %s", GetSQLValueString($FormAccID_rsAccSelected, "int"));
$rsAccSelected = mysql_query($query_rsAccSelected, $RTMFadmin) or die(mysql_error());
$row_rsAccSelected = mysql_fetch_assoc($rsAccSelected);
$totalRows_rsAccSelected = mysql_num_rows($rsAccSelected);
I am wanting the form variable value to come from a form on the same page like so..
<form method="post" name="select-company" id="select-company" action="new-enquiry-a.php">
<div class="form-group">
<label class="control-label col-sm-2" for="subject">RTM Company</label>
<div class="col-sm-4">
<select class="form-control" id="subject" name="subject" aria-describedby="helpblock">
<option value="select">Please choose an RTM Company</option>
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_rsRtmCompanies){
?>
<option value="<?php echo $row_rsRtmCompanies['members_id']; ?>"><?php echo $row_rsRtmCompanies['company_name']; ?></option>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_rsRtmCompanies && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_rsRtmCompanies = mysql_fetch_assoc($rsRtmCompanies);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
</select>
</div><!-- /.col-sm-4 -->
<input name="submit-selection" class="btn btn-default" type="submit" value="select">
</div><!-- /.form-group -->
</form>
I have set the form action as a URL to the same page but when I submit the form but nothing seems to happen. I haven't used this technique before so maybe i'm missing something.
I've also attached the page.
Any ideas?