473,387 Members | 1,669 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,387 software developers and data experts.

Preserving form information

Two problems that I'm having (due to being a n00bie) are:

The form I'm using is the basic form with a username, email address
etc.. the two that I'm most concerned about are the Gender, and State
form entries.

Gender is of course two radio buttons.

<input name="gender" type="radio" id="male" value="M"> M
<input name="gender" type="radio" id="female" value="F">F

None of the two are checked by default, but what I'd like to do is
this.. if the user doesn't enter a required information field, keep
the information that he has listed thus far. So if they entered M or
F, but didn't enter a required field and the form reloads I want their
chioce to still be 'checked'.

With the other forms this works fine, for example, with $first_name =
$_post['first_name'] and the forms value of <? echo $first_name ?>
But, boiling it all down to my main question - How do I keep the radio
button information for the reloaded form?
Thanks in advance for any information,
A.Kelly
Jul 17 '05 #1
2 1947
A.Kelly wrote:
Two problems that I'm having (due to being a n00bie) are:

The form I'm using is the basic form with a username, email address
etc.. the two that I'm most concerned about are the Gender, and State
form entries.

Gender is of course two radio buttons.

<input name="gender" type="radio" id="male" value="M"> M
<input name="gender" type="radio" id="female" value="F">F

None of the two are checked by default, but what I'd like to do is
this.. if the user doesn't enter a required information field, keep
the information that he has listed thus far. So if they entered M or
F, but didn't enter a required field and the form reloads I want their
chioce to still be 'checked'.

With the other forms this works fine, for example, with $first_name =
$_post['first_name'] and the forms value of <? echo $first_name ?>
But, boiling it all down to my main question - How do I keep the radio
button information for the reloaded form?
Thanks in advance for any information,
A.Kelly

Hi,

I think you can reloaded the formwith a php script: with an argument in
the url: form.php?gender=M or F.

Bye

Jul 17 '05 #2
I noticed that Message-ID:
<79**************************@posting.google.com > from A.Kelly contained
the following:
With the other forms this works fine, for example, with $first_name =
$_post['first_name'] and the forms value of <? echo $first_name ?>
But, boiling it all down to my main question - How do I keep the radio
button information for the reloaded form?


add variables to the buttons

Then it's just an if statement

if(isset($_POST['gender'])){
$statusm="";
$statusf="";
if($_POST['gender']=="M"){$statusm="checked"}
else{$statusf="checked"}
}
<input name="gender" type="radio" id="male" value="M"<?php echo $statusm
?>> M
<input name="gender" type="radio" id="female" value="F"<?php echo
$statusf ?>>F

Untested.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Karl | last post by:
This might not really be a javascript question, but I'll start with this group. At http://www.gazingus.org/ there is a very nice collapsible menu written using CSS and Javascript >>>> Using...
4
by: Marc Tanner | last post by:
Hello, I am currently working on a eventhandling system or something similar, and have the problem of loosing scope. I have read many interesting posts on this group and the faq article about...
2
by: cefrancke | last post by:
I have a form (no underlying record set) that has two separate sub-forms on it. Each sub-form has data from two different tables. Above each sub-form there is one unbound combo box with a SQL...
16
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. ...
0
by: Mike Schilling | last post by:
I have some code that calls methods reflectively (the method called and its parameters are determined by text received in a SOAP message, and I construct a map from strings to MethodInfos). The...
2
by: Pete | last post by:
Hi all... I sincerly hope one of the MS guys can clear this up for me... First some background... Ok, I have a web site which is fully translatable into several languages. All the strings...
1
by: jeffrobbins | last post by:
Hello, I am having an issue that I haven't been able to find an answer for. Any help or pointers to information would be appreciated. I have a form, lets call it mainForm, that contains a...
3
by: Finder | last post by:
Hi, Can anyone please help me with the following problem that i am having? Basically i have a form containing Few fields like name age country,state. After Filling the name , age and i...
3
by: sophia.agnes | last post by:
Dear all, I was going through the book "C a software engineering approach by darnell & Margolis" there was a section named sign preserving vs value preserving it is as follows sign...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.