473,396 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.

Expand|Select|Wrap|Line Numbers
  1. <p>Do you enjoy web designing?<br />
  2.     <input name="ans1" type="radio" value="yes" 
  3.      <?php if ($_GET["ans1"]=="yes") echo "checked=\"checked\""; ?>/>    
  4.       yes &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  5.  
  6.       <input name="ans1" type="radio" value="no" 
  7.      <?php if ($_GET["ans1"]=="no") echo "checked=\"checked\""; ?>/> 
  8.       no &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  9.  
  10.       <input name="ans1" type="radio" value="unsure" 
  11.      <?php if ($_GET["ans1"]=="unsure") echo "checked=\"checked\""; ?>/>unsure</p>
  12.  
  13.  
Dec 11 '08 #1
7 3096
Markus
6,050 Expert 4TB
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.
Dec 11 '08 #2
Forgive my ignorance. I'm not sure what you mean. I've tried the form with both POST and GET.
Dec 11 '08 #3
Markus
6,050 Expert 4TB
@wktarin
Can you post the full form, please?

Thanks,
Markus.
Dec 11 '08 #4
Markus
6,050 Expert 4TB
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.
Dec 11 '08 #5
Atli
5,058 Expert 4TB
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.
Dec 12 '08 #6
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.
Dec 13 '08 #7
I decided to simply have the links open in another window. Thank you both for your input.
Dec 16 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jeff | last post by:
I'm trying to create a dynamic form that can have multiple groups of radio buttons (each group has two buttons) with the same name. Essentially, the form allows a user to enter as many names as...
4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
6
by: Craig Keightley | last post by:
I have a page that has n number of radio groups (yes/No) how can i prevent the form being submitted if more than one radio group is not selected? By default all radio groups are unchecked ...
2
by: James P. | last post by:
Help, I need to display radio buttons on a form. The data is from SQL table: each row in each table is displayed as a radio button. I have multiple SQL tables so I understand I need to put...
1
by: kenny8787 | last post by:
Hi, can anyone help here? I have the following code generated from a database, I want to have javascript calculate the costs of the selected items using radio buttons, subtotal the costs and...
4
by: FlaPnthrsPunk | last post by:
Hi all, this is my first time ever using PHP, and I am still very new to programming in general. I'm doing an assignment for my Media E-Commerce class where the code for a survey is all provided. ...
2
by: dpazza | last post by:
Hi, I'm creating a quiz on using a form in VB 2005 express. I have four sets of questions and answers (labels and radio buttons) and I change between which set of questions is currently shown on...
4
by: Blasting Cap | last post by:
I have a page that has a number of radio buttons that will be displayed to different access levels of a user who logs in to my website. For instance, if there are a dozen buttons, user1 will see...
2
by: roger26 | last post by:
I am having trouble with a registration page. Which contains 3 groups of radio buttons and a check box i having hard time to making it work. I have added code for matching the password too but having...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.