Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't Post "Value" From Radio Button to Table
    primarykey
    data
    text
    <p>Created a form that uses radio buttons, but I was unable to post the value to the <strong>SponsorRegistration</strong> table. </p> <p>The 5 columns of the table are named <em>Breakfast</em>, <em>Lunch</em>, <em>Dinner</em>, <em>Supper</em> and <em>Dessert</em>. </p> <p>When a customer selects <em>Breakfast</em> and click Submit, a "Y" (Yes) should be posted under the specific column but this is not the case for me. </p> <p>The <strong>SponsorAmount</strong> table contains the amount of money sponsored for each meal. I think there should be a "if" and "elseif" statements for these radio buttons but I don't know how to incorporate to make it work.</p> <p><strong>HTML</strong></p> <pre><code>''''BUILD RECORDSET CONNECTION STATIC Set OnAmount = Server.CreateObject("ADODB.Recordset") SQLStrAmount = "SELECT * FROM SponsorAmount" OnAmount.Open SQLStrAmount, Connect, adOpenStatic breakfastValue = OnAmount("Breakfast") lunchValue = OnAmount("Lunch") goldValue = OnAmount("Gold") diamondValue = OnAmount("Diamond") platinumValue = OnAmount("Platinum") ''''CLOSE RECORDSET CONNECTION OnAmount.Close Set OnAmount = nothing &lt;form method="post" action="SponsorPost.asp" onSubmit="return submitIt(this)"&gt; &lt;input type="radio" name="sponsorlevelValue" value='breakfastValue' checked='checked'&gt;&lt;b&gt;Breakfast&lt;/b&gt; &lt;input type="radio" name="sponsorlevelValue" value='lunchValue' checked='checked'&gt;&lt;b&gt;Lunch&lt;/b&gt; &lt;input type="radio" name="sponsorlevelValue" value='dinnerValue' checked='checked'&gt;&lt;b&gt;Dinner&lt;/b&gt; &lt;input type="radio" name="sponsorlevelValue" value='supperValue' checked='checked'&gt;&lt;b&gt;Supper&lt;/b&gt; &lt;input type="radio" name="sponsorlevelValue" value='dessertValue' checked='checked'&gt;&lt;b&gt;Dessert&lt;/b&gt; &lt;/form&gt; </code></pre> <p>Here is the "<strong>SponsorPost.asp</strong>" page. Except for the <b>sponsorlevelValue</b>, all the other Values get stored in the database.<br /><br /></p> <pre><code>&lt;% peopleVal = Request("peopleValue") meetingVal = Request("meetingValue") sponsorlevelVal = Request("sponsorlevelValue") paymentTypeVal = Request("paymentTypeValue") giftVal = Request("giftValue") itemVal = Request("itemValue") ''''BUILD DATABASE CONNECTION Set Connect = Server.CreateObject("ADODB.Connection") Connect.Open "Provider=SQLOLEDB; Data Source=XXXXXX; Initial Catalog=XXX; User ID=XXX; Password=XXX" ''''BUILD RECORDSET CONNECTION STATIC Set OnRS = Server.CreateObject("ADODB.Recordset") SQLStr = "SELECT * FROM SponsorRegistration WHERE Deleted='N'" OnRS.Open SQLStr, Connect, adOpenDynamic, adLockOptimistic OnRS.AddNew OnRS("PeopleIDNum") = CLng(peopleVal) OnRS("MeetingIDNum") = CLng(meetingVal) OnRS("RegistrationDate") = tDate OnRS("PaymentTypeIDNum") = CLng(paymentTypeVal) OnRS("Gift") = giftVal OnRS("Item") = itemVal OnRS("Paid") = "N" OnRS("Deleted") = "N" OnRS.Update ''''CLOSE RECORDSET CONNECTION OnRS.Close Set OnRS = nothing ''''CLOSE DATABASE CONNECTION Connect.Close Set Connect = nothing %&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload