php - Keeping Values entered on submit -


i have following code in input fields keep date showing when submit button clicked

<?= isset($_post['first_name']) ? $_post['first_name'] : '' ?> 

but how code select area?? eg;

<option value="<?= isset($_post['prof']) ? $_post['prof'] : 'prof' ?>">prof</option> <option value="<?= isset($_post['dr']) ? $_post['dr'] : 'dr' ?>">dr</option> <option value="<?= isset($_post['mr']) ? $_post['mr'] : 'mr' ?>">mr</option> <option value="<?= isset($_post['mrs']) ? $_post['mrs'] : 'mrs' ?>">mrs</option> <option value="<?= isset($_post['ms']) ? $_post['ms'] : 'ms' ?>">ms</option> <option value="<?= isset($_post['miss']) ? $_post['miss'] : 'miss' ?>">miss</option> 

i think mean:

<option <?=isset($_post['prof']) ? "value='".$_post['prof']."' selected" : 'prof' ?>>prof</option> <option <?=isset($_post['dr']) ? "value='".$_post['dr']."' selected" : 'dr' ?>>dr</option> <option <?=isset($_post['mr']) ? "value='".$_post['mr']."' selected" : 'mr' ?>>mr</option> <option <?=isset($_post['mrs']) ? "value='".$_post['mrs']."' selected" : 'mrs' ?>>mrs</option> <option <?=isset($_post['ms']) ? "value='".$_post['ms']."' selected" : 'ms' ?>>ms</option> <option <?=isset($_post['miss']) ? "value='".$_post['miss']."' selected" : 'miss' ?>>miss</option> 

you want there selected attribute 1 chosen, in doing have 'jig' code value display in if statement too.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -