Re: [PHP] Tutorial on Re-filling form data?

[email protected] (Aziz Saleh)
Newsgroups php.general
Message-ID <CAPJtNhWvH3qQ8E4r38nbrbJTEUGcaC6_UsEUyMiaqcf4Ta4NyA@mail.gmail.com>
On Thu, Jun 22, 2017 at 2:15 PM, leam hall <[email protected]> wrote:

> Using PHP 5 and not OOP savvy.
>
> I have a form that gives the user options. On submit it calls itself
> and if the $_POST variable is set produces the result of the form
> choices. However, it currently resets all the form options to default
> values.
>
> Is there a tutorial somewhere on how to keep the existing form choices
> in place, unless the user changes the selection and resubmits?
>
> Thanks!
>
> Leam
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
You just want the ability to have the inputs pre-selected based on user
input? Shouldn't be hard by doing the same thing you did for the actual
form submit for each input.

Ex:
<input type="text" id="username" name="username" value="<?php echo
(isset($_POST['username']) ? $_POST['username'] : '';?>" />

You would do the same with radio/check/select, but in a different manner of
course.

Ps: Your email went to spam, thus the late reply.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.