close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


How to use a form variable to determine recordset values

Thread began 11/03/2015 6:30 am by s.joiner74419001 | Last modified 11/03/2015 5:41 pm by Ray Borduin | 704 views | 1 replies |


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>
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
if($RepeatSelectionCounterBasedLooping_1 || $row_rsRtmCompanies){
<option value="<?php echo $row_rsRtmCompanies['members_id']; ?>"><?php echo $row_rsRtmCompanies['company_name']; ?></option>
} // RepeatSelectionCounter_1 Begin Alternate Content
<?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 End Loop

</div><!-- /.col-sm-4 -->
<input name="submit-selection" class="btn btn-default" type="submit" value="select">
</div><!-- /.form-group -->

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?

Attached Files
Sign in to reply to this post

Ray BorduinWebAssist

The hidden form element you have never has a value.... I think you want to set the rsAccSelected Recordset to use the value from the "subject" form post and not the value from the "members_id" hidden form element, because that hidden field won't have a value.

Try changing the parameter referenced on line 44-45 to 'subject' instead of 'members_id'

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...