473,804 Members | 3,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1966
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
1805
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 Lists for DHTML Menus HTML lists, along with well-placed CSS and JavaScript, result in flexible dynamic menus that gracefully degrade in older browsers.<<<<<<<
4
2419
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 closure, but it seems that i have still not understood everything. Below is my attempt to preserve the scope but it's not really nice and i think with the use of closure could it be done better. But at the moment i am quite confused and hope that...
2
2851
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 record source that returns an ID field and a Text field. Next to each combo box is two buttons, one that 'Applys' the filter of the sub-form to the value in the combo box and one that 'Clears' the form's current filter. When the click event of the...
16
5151
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. And K&R2 mentions "signed extension" everywhere. Reading some old clc posts, I've beginning to realize that these books are over-generalizing the topic. I am just wondering what the difference between the following pairs of terms are: 1)...
0
3678
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 code that does the call looks roughly like: try { // do reflective call response = method.Invoke(obj, params); }
2
3382
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 for the web site are held in a database and all the labels, buttons etc are populated at run time in the Page_Load handler. The retreval of the strings from the database is all
1
2586
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 dropdownlist of offices that is populated from a database query, and other form elements. A second form, lets call it childForm, can be opened (window.open()) via a link off of mainForm to add another office to the database. What I would like is to be...
3
1671
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 selecting Drop down box of country the auto select of state is changes the value based on country. when it changes the page is refreshed and all information above in name ,age is disappred. can any one tel me how to preserve those values ?
3
3304
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 preserving rule:- when signed and un signed objects meet in an expression, the result is
0
10332
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10320
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9150
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4299
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.