/    Sign up×
Community /Pin to ProfileBookmark

Re-populate form after failed validation and for editing (only one form).

I managed to repolulate a form after validatin fails.

[url]https://github.com/FernandoBasso/musicmanager/blob/master/usuario/form.html.php[/url]

in line 22, and the function ‘oldval()’ is in helpers/helpers.inc.php’.

Now, I need to repopulate the form for editing the user details. I just select the
data from the database based on the user’s id and repopulate the form with that data.

The problem is that I need to put the data inside the form’s “value” attribute but I can’t
figure out how to do that for both situations (after form validation fails and edit user)
using the same form.

I have this for re-polulating the values after validation fails:

[code]value='<?= oldval(‘nome’); ?>’[/code]

but for editing user I need another function.

I hope someone can give me some insights. Thanks in advance.

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @FernandoBasso 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.26,
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,
)...