/    Sign up×
Community /Pin to ProfileBookmark

form radio button data retention

i have a form that returns the user upon a number of errors (of course) – i’m able to retain the text input data (value=”<?php echo $_POST[’em_name’] ?>”) upon return, but i don’t know how to retain the radio button or checkbox data so that they don’t have to recheck it if necessary. it’s in html/php…

can someone help?

much appreciated…

GN

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@AltriakMar 24.2008 — Something like this should work:
[code=php]
<input type="radio" name="thename" value="thevalue" <?php if (isset($_POST['thename']) && ($_POST['thename'] == 'thevalue')) echo ' checked="checked"'; ?>
...
...
[/code]
Copy linkTweet thisAlerts:
@glenn_phpauthorMar 24.2008 — beautiful - worked great with radio and checkbox...

thanks

GN
×

Success!

Help @glenn_php spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...