Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Initialize Form Field with Passed Parameter

Avatar of slegy
slegy asked on
Adobe DreamweaverWeb Applications
4 Comments1 Solution247 ViewsLast Modified:
I have an event description page with a link to another page called "Who's Coming." Members can enter their information if they plan to attend the event. The page also lists those who have already entered their information.

I'm running into a problem with the first entry for an event. The event description page passes the numeric ID for the event which is then used as they key for the who's coming table. I believe what I need to do is get that value into the hidden eventID field in the form, but I can't figure out how to do that.

This is where it gets the ID#:

<%
Dim rswhosComing__MMColParam
rswhosComing__MMColParam = "21"
If (Request.Querystring("eventID")     <> "") Then
  rswhosComing__MMColParam = Request.Querystring("eventID")    
End If
%>
<%
Dim rswhosComing
Dim rswhosComing_cmd
Dim rswhosComing_numRows

Set rswhosComing_cmd = Server.CreateObject ("ADODB.Command")
rswhosComing_cmd.ActiveConnection = MM_eventCalendar_STRING
rswhosComing_cmd.CommandText = "SELECT * FROM whosCominglist WHERE eventID=?"
rswhosComing_cmd.Prepared = true
rswhosComing_cmd.Parameters.Append rswhosComing_cmd.CreateParameter("param1", 5, 1, -1, rswhosComing__MMColParam) ' adDouble

Set rswhosComing = rswhosComing_cmd.Execute
rswhosComing_numRows = 0
%>

Here's the form:
         <p align="center" class="style3 style5">&nbsp;</p>
         <p align="center" class="style3 style5">Who's Coming to the </p>
         <div id="listMe">
            <form action="<%=MM_editAction%>" method="POST" name="attendeeAdd">
               <fieldset id="attendeeInfo">
               <legend class="attendeelegend style7">List MeAttendee Information</legend>
               <label for="name"><br />
               <span class="style7">First and Last Name:</span></label>
               <input name="attendeeName" type="text" id="attendeeName" tabindex="1" size="48"  maxlength="48" />
               <label for="hull"><br />
               <span class="style7">Hull Number:</span></label>
               <input name="hullNo" type="text" id="hullNo" tabindex="2" size="8"  maxlength="5" />
               <label for="location"><br />
               <span class="style7">Location:</span></label>
               <input name="location" type="text" id="location" tabindex="3" size="48"  maxlength="48" />
               <label for="name"><br />
               <span class="style7">Email:</span></label>
               <input name="email" type="text" id="email" tabindex="4" size="48"  maxlength="48" />
               <br />
               <br />
               <input type="submit" name="list" id="list" value="List Me" tabindex="5" />
               <input type="reset" name="reset" id="reset" value="Reset" />
               <br />
               <br />
               </fieldset>
               <input type="hidden" name="MM_insert" value="attendeeAdd" />
               <input name="eventID" type="hidden" id="eventID" value="<%=(rswhosComing.Fields.Item("eventID").Value)%>" />
            </form>

The hidden eventID field is what errors out when there have been no entries for the designated event (of course, because there are no records).

Here is the update code for the entered info:
<%
If (CStr(Request("MM_insert")) = "attendeeAdd") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_eventCalendar_STRING
    MM_editCmd.CommandText = "INSERT INTO whosComing (attendeeName, hulllNo, location, email, eventID) VALUES (?, ?, ?, ?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 60, Request.Form("attendeeName")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(Request.Form("hullNo"), Request.Form("hullNo"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 60, Request.Form("location")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 60, Request.Form("email")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 5, 1, -1, MM_IIF(Request.Form("eventID"), Request.Form("eventID"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
  End If
End If
%>

I would appreciate any suggestions.
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. LevineFlag of United States of America imageDon't talk to me.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers