SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help in radio button

    Hi,

    I have this code which i cannot sort it out on a radio button. Everything in the form works exactly as it is except i cannot get the radio button name submission to work.

    The output of the form when submitted which is working except the radio button selection which when the user tick the template, it should also send the label/name of the selected:

    This the output of the form, missing the radio button selected:

    From: Name of Sender
    To: Email Receipent (the office)
    Room Number: 123
    Message:
    Test Message


    IP Address: 00.000.000.00

    If anyone can shed a light on where i am missing, I would appreciate it so much. Below are the codes in Classic ASP:

    sendemail.asp

    'GET VALUES FROM USER
    GetIP = Request.ServerVariables("REMOTE_ADDR")
    SenderEmail_Who_xxx = StripHTML(TRIM(Request.Form("fromWho")))
    SenderName = Server.HTMLEncode(StripHTML(TRIM(Request.Form("sender_name"))))
    PatientName = Server.HTMLEncode(StripHTML(TRIM(Request.Form("patient"))))
    RoomNumber = Server.HTMLEncode(StripHTML(TRIM(Request.Form("room"))))
    Comments = Server.HTMLEncode(StripHTML(TRIM(Request.Form( "comments"))))

    'CHECK FOR UNNECESSARY CODES; NO SPAMMERS ALLOWED
    CommentsFilter = InStr(1,Comments,"http",1)
    EmailPatientFilter = Instr(1,SenderEmail_Who_xxx,"@",1)

    if SenderEmail_Who_xxx = "" OR EmailPatientFilter = 0 then
    Response.Redirect BaseURL
    end if

    if CommentsFilter = 0 then
    FilterAlert = TRUE
    else
    FilterAlert = FALSE
    end if

    if FilterAlert = TRUE then
    SUB sendmail( fromWho, toWho, toAlso, Subject, Body )
    Dim objCDO
    Dim iConf
    Dim Flds

    Const cdoSendUsingPort = 2

    Set objCDO = Server.CreateObject("CDO.Message")
    Set iConf = Server.CreateObject("CDO.Configuration")

    Set Flds = iConf.Fields
    With Flds
    .Item(cdoSendUsingMethod) = cdoSendUsingPort
    .Item(cdoSMTPServer) = "mail-fwd"
    .Item(cdoSMTPServerPort) = 25
    .Item(cdoSMTPconnectiontimeout) = 10
    .Update
    End With

    Set objCDO.Configuration = iConf

    objCDO.From = fromWho
    objCDO.To = toWho
    objCDO.CC = toAlso
    objCDO.Subject = Subject
    'objCDO.TextBody = Body
    objCDO.HTMLBody = Body
    objCDO.Send
    END SUB

    fromWho = SenderEmail_Who_xxx
    toWho = "xxx@email.com"
    Subject = "Attention: Somebody Send an Email for a Patient"
    Body = "<strong>From/strong> " & SenderName & "<br />"_
    & VBCrLf & "<strong>To/strong> " & PatientName & "<br />"_
    & VBCrLf & "<strong>Room Number/strong> " & RoomNumber & "<br />"_
    & VBCrLf & "<strong>Message/strong><br />" & Comments & "<br /><br /><br />"_
    & VBCrlf & "<strong>IP Address/strong> " & GetIP

    If fromWho <> "" THEN
    sendMail fromWho, toWho, toAlso, Subject, Body,

    'Cleanup
    Set ObjCDO = Nothing
    Set iConf = Nothing
    Set Flds = Nothing
    Response.redirect BaseURL & "&action=1"
    END IF
    else
    Response.redirect BaseURL & "&errmsg=1"
    end if
    %>
    emailpatient.asp
    <!--#include virtual ="/script/StripHTML.asp" -->

    <%
    sub showemail()
    action = Server.URLEncode(StripHTML(TRIM(Request.QueryString("action"))))

    Response.Write "<div class=""subheader""><strong>" & UCASE(SubSectTitle) & "</strong></div>"

    if action = "" then

    errmsg = StripHTML(TRIM(Request.Querystring("errmsg")))

    if errmsg = "1" then
    PrintMe = "<strong style='color:red;'>You are not allowed to insert those characters!</strong>"
    end if
    %>
    <!-- email a patient form -->
    <p>some description here</p>
    <% if PrintMe <> "" then %><div style="padding:10px 0 10px 0;"><%=PrintMe %></div><% end if %>
    <div align="center">
    <form method="post" action="/eservices/sendemail.asp" name="EmailPatients" id="EmailPatients" class="cmxform">
    <fieldset>
    <div class="itemheader"><strong>MESSAGE DETAILS</strong></div>

    <div class="emailwrapper">
    <label for="sender_name" class="styleme"><span style="color: #ff0000">*</span> <strong>Your Name/strong></label>
    <div class="fieldme"><input type="text" name="sender_name" size="40" maxlength="50" class="forms" /></div>
    </div>
    <div class="emailwrapper">
    <label for="fromWho" class="styleme"><span style="color: #ff0000">*</span> <strong>Your Email Address/strong></label>
    <div class="fieldme"><input type="text" name="fromWho" size="25" maxlength="20" class="forms" /></div>
    </div>
    <div class="emailwrapper">
    <label for="patient" class="styleme"><span style="color: #ff0000">*</span> <strong>Patient&acute;s Name/strong></label>
    <div class="fieldme"><input type="text" name="patient" size="40" maxlength="50" class="forms" /></div>
    </div>
    <div class="emailwrapper">
    <label for="room" class="styleme"><strong>Patient&acute;s room number/strong></label>
    <div class="fieldme"><input type="text" name="room" size="10" maxlength="10" class="forms" style="width:75px;" /></div>
    </div>
    <div class="emailwrapper">
    <label for="comments" class="styleme">
    <span style="color: #ff0000">*</span> <strong>Your Message/strong>
    </label>
    <div class="fieldme">
    <textarea name="comments" rows="8" cols="50" class="forms" onKeyDown="textCounter(this.form.comments,this.form.details,300);" onKeyUp="textCounter(this.form.comments,this.form.details,300);"></textarea> <br />
    <input readonly type="text" name="details" size="3" maxlength="3" value="300" class="forms" style="width:30px" /> Max. number of characters
    <label style="display:none;" for="comments" class="warning" style="float:left;">Required</label>
    </div>
    </div>
    <!-- ecard selection -->
    <div class="ecardform">
    <label for="ecard" class="styleme"><span style="color: #ff0000">*</span><strong>Tick the circle to choose an ecard template. Click image for preview.</strong></label><br /><br />
    <div align="center">
    <input type="radio" name="radio" id="temp1" value="temp1" />
    <a href="images/ecard/jpeg/temp1.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp1.jpg" /></a>
    <input type="radio" name="radio" id="temp2" value="temp2" />
    <a href="images/ecard/jpeg/temp2.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp2.jpg" /></a>
    <input type="radio" name="radio" id="temp3" value="temp3" />
    <a href="images/ecard/jpeg/temp3.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp3.jpg" /></a><br /><br />
    <input type="radio" name="radio" id="temp4" value="temp4" />
    <a href="images/ecard/jpeg/temp4.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp4.jpg" /></a>
    <input type="radio" name="radio" id="temp5" value="temp5" />
    <a href="images/ecard/jpeg/temp5.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp5.jpg" /></a>
    <input type="radio" name="radio" id="temp6" value="temp6" />
    <a href="images/ecard/jpeg/temp6.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp6.jpg" /></a><br /><br />
    <input type="radio" name="radio" id="temp7" value="temp7" />
    <a href="images/ecard/jpeg/temp7.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp7.jpg" /></a>
    <input type="radio" name="radio" id="temp8" value="temp8" />
    <a href="images/ecard/jpeg/temp8.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp8.jpg" /></a>
    <input type="radio" name="radio" id="temp9" value="temp9" />
    <a href="images/ecard/jpeg/temp9.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp9.jpg" /></a><br /><br />
    <input type="radio" name="radio" id="temp10" value="temp10" />
    <a href="images/ecard/jpeg/temp10.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp10.jpg" /></a>
    <input type="radio" name="radio" id="temp11" value="temp11" />
    <a href="images/ecard/jpeg/temp11.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp11.jpg" /></a>
    <input type="radio" name="radio" id="temp12" value="temp12" />
    <a href="images/ecard/jpeg/temp12.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp12.jpg" /></a><br /><br />
    <input type="radio" name="radio" id="temp13" value="temp13" />
    <a href="images/ecard/jpeg/temp13.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp13.jpg" /></a>
    <input type="radio" name="radio" id="temp14" value="temp14" />
    <a href="images/ecard/jpeg/temp14.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp14.jpg" /></a>
    <input type="radio" name="radio" id="temp15" value="temp15" />
    <a href="images/ecard/jpeg/temp15.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp15.jpg" /></a><br /><br />
    <input type="radio" name="radio" id="temp16" value="temp16" />
    <a href="jpeg/temp16.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp16.jpg" /></a>
    <input type="radio" name="radio" id="temp17" value="temp17" />
    <a href="images/ecard/jpeg/temp17.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp17.jpg" /></a>
    <input type="radio" name="radio" id="temp18" value="temp18" />
    <a href="images/ecard/jpeg/temp18.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp18.jpg" /></a><br /><br />
    <input type="radio" name="radio" id="temp19" value="temp19" />
    <a href="images/ecard/jpeg/temp19.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp19.jpg" /></a>
    <input type="radio" name="radio" id="temp20" value="temp20" />
    <a href="images/ecard/jpeg/temp20.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp20.jpg" /></a>
    <input type="radio" name="radio" id="temp21" value="temp21" />
    <a href="images/ecard/jpeg/temp21.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp21.jpg" /></a><br /><br />
    <input type="radio" name="radio" id="temp22" value="temp22" />
    <a href="images/ecard/jpeg/temp22.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp22.jpg" /></a>
    <input type="radio" name="radio" id="temp23" value="temp23" />
    <a href="images/ecard/jpeg/temp23.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp23.jpg" /></a>
    <input type="radio" name="radio" id="temp24" value="temp24" />
    <a href="images/ecard/jpeg/temp24.jpg" rel="shadowbox"><img src="images/ecard/thumb/temp24.jpg" /></a>
    </div>
    <br /><br />
    <div class="itemheader"><strong>VERIFICATION CODE</strong></div>
    <div class="emailwrapper" style="text-align:left;">
    <p>By entering the code you see below, you help us prevent automated programs from using this service. This ensures better performance for delivering messages and greetings to patients. Please type the code the way it appears or else an error will occur.</p>
    </div>
    <div class="emailwrapper">
    <label for="VerifyMe" class="styleme"><span style="color: #ff0000">*</span> <strong>Enter the code shown/strong></label>
    <div class="fieldme">
    <div style="float:left; width:120px;"><input type="text" name="verifycode" maxlength="6" class="verifyme" /></div>
    <div style="background:url('/helpers/vercode/bg.gif'); width:40%; float:left; text-align:center;">
    <%
    For intWriteDigitLoopCount = 1 to Len(randnum)
    'Display the graphical hit count
    Response.Write("<img src=""/helpers/vercode/")
    Response.Write(Mid(randnum, intWriteDigitLoopCount, 1) & ".gif""")
    Response.Write("alt=""" & Mid(randnum, intWriteDigitLoopCount, 1) & """>")
    Next
    %>
    </div>
    <input type="hidden" id="generatedcode" name="generatedcode" value="<%=randnum%>" />
    </div>
    </div>

    <div align="right" style="padding:5px;">
    <input type="submit" name="MySend" value="send email" class="button" style="width:75px;" />
    <input type="reset" name="reset" value="clear" class="button" style="width:50px;" />
    </div>
    </fieldset>
    </form>
    </div>
    <p style="margin-top:20px"><a name="details"></a><b>Email a Patient Details</b><br />
    <p>Please note the service is setup only to receive messages. We cannot send outgoing replies. We respect message confidentiality. If you are going to be a patient and would like information on how your loved ones and friends can email you, read our <a href="#" id="create-user">Patient Q&amp;A</a>.</p>
    <!-- end of email a patient form -->
    <div id="dialog" title="EMAIL A PATIENT - Q &amp; A"><!-- #include virtual = "/dox/emailpatientQA.asp" --></div>
    <% else %>
    <p><strong>YOU HAVE SENT AN EMAIL TO A PATIENT</strong></p>
    <p>Thank you for using &quot;Email a Patient&quot; to send a greeting to a friend or family member who may be a patient in our hospital.</p>

    <%
    end if

    end sub
    %>

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2012
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How are you trying to get the value of radio ?

    Request("radio") ?

  3. #3
    SitePoint Member
    Join Date
    Nov 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i sort it out with the below revised code:

    <input type="radio" name="radio" id="temp1" value="temp1" /> to <input type="radio" name="template" id="temp1" value="temp1" />

    then on the ASP.

    'GET VALUES FROM USER
    GetIP = Request.ServerVariables("REMOTE_ADDR")
    SenderEmail_Who_xxx = StripHTML(TRIM(Request.Form("fromWho")))
    SenderName = Server.HTMLEncode(StripHTML(TRIM(Request.Form("sender_name"))))
    PatientName = Server.HTMLEncode(StripHTML(TRIM(Request.Form("patient"))))
    RoomNumber = Server.HTMLEncode(StripHTML(TRIM(Request.Form("room"))))
    Comments = Server.HTMLEncode(StripHTML(TRIM(Request.Form( "comments"))))
    Ecard = Server.HTMLEncode(StripHTML(TRIM(Request.Form( "template"))))

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    That's exactly what I was about to post as a suggestion as I read your post ... then I saw the replies.
    Ian Anderson
    www.siteguru.co.uk


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •