Trouble Making Radio Buttons Sticky

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wktarin
    New Member
    • Nov 2008
    • 7

    Trouble Making Radio Buttons Sticky

    I've constructed a survey form, and I want to make the radio buttons sticky, so that if participants leave the page, they can return to find their answers still in tact. However, I can't seem to find the right code to make the radio buttons sticky. Below is the code I'm using. Any help would be appreciated.

    Code:
    <p>Do you enjoy web designing?<br />
    	<input name="ans1" type="radio" value="yes" 
    	 <?php if ($_GET["ans1"]=="yes") echo "checked=\"checked\""; ?>/>    
    	  yes &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    
    	  <input name="ans1" type="radio" value="no" 
    	 <?php if ($_GET["ans1"]=="no") echo "checked=\"checked\""; ?>/> 
    	  no &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    
    	  <input name="ans1" type="radio" value="unsure" 
    	 <?php if ($_GET["ans1"]=="unsure") echo "checked=\"checked\""; ?>/>unsure</p>
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Is the form passed by GET? Sounds obvious, but the code works for me as long as I pass the values through the GET method.

    Comment

    • wktarin
      New Member
      • Nov 2008
      • 7

      #3
      Forgive my ignorance. I'm not sure what you mean. I've tried the form with both POST and GET.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by wktarin
        Forgive my ignorance. I'm not sure what you mean. I've tried the form with both POST and GET.
        Can you post the full form, please?

        Thanks,
        Markus.

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Oh wait, sorry, I read the question wrong. You want people to be able to navigate away from the page, then return and still have the form values?

          You'd have to use sessions to hold the form values.

          Check out this article.

          Thanks,
          Markus.

          Comment

          • Atli
            Recognized Expert Expert
            • Nov 2006
            • 5062

            #6
            On thing that could be a problem.

            Do you want people to be able to navigate away *while* answering the form, without submitting it, and then return to find the answers as they left them?

            If that is the case, you would have to look into JavaScript solutions.
            PHP can only work with the data it is given, and you would actually have to submit the form to get the data to your PHP code.

            Comment

            • wktarin
              New Member
              • Nov 2008
              • 7

              #7
              Thank you for your responses. Could you give me a hint about what JavaScript I would need to use, or where I could find information on constructing it? I'm really not familiar with Java (and I'm pretty green at PHP, for that matter.) Thanks for helping.

              Comment

              • wktarin
                New Member
                • Nov 2008
                • 7

                #8
                I decided to simply have the links open in another window. Thank you both for your input.

                Comment

                Working...