Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php keep input value after submit

<input type="text" name="myField1" value="<?php echo isset($_POST['myField1']) ? $_POST['myField1'] : '' ?>" />
Comment

keep value after submit php

// Author: Rimon(ProgrammerRimon), this code was pasted by ProgramemrRimon
// Date: 2022-02-19, 3:29 AM GMT + 6
<?php

if (isset($_REQUEST['f'])) echo 'Fruits: ' . $_REQUEST['f'];
echo "<br>";
if (isset($_REQUEST['v'])) echo 'Vagetables: ' . $_REQUEST['v'];
global $v, $f;
$f = ['apple', 'banana', 'papaya', 'mangos', 'carrot', 'grapes', 'guava', 'strawbarries', 'watermelons', 'Pomegranates'];
$v = ['lettuce', 'cabbage', 'onion', 'garlic',  'Asparagus', 'Rhubarb', 'Celery', 'Spinach', 'Arugula', 'Broccoli'];
function s($a, $n)
{
    $s = '';
    foreach ($a as $key => $value) {
        if (isset($_REQUEST[$n])) {
            if ($_REQUEST[$n] == $value) {
                $s = 'selected';
            } else {
                $s = '';
            }
        }
        echo "<option $s value='" . $value . "' >$value</option>";
    }
}
?>
<form action="" method="post">
    <select name="f" id="">
        <?php s($f, 'f'); ?>
    </select>
    <br>
    <select name="v" id="">
        <?php s($v, 'v'); ?>
    </select>
    <input type="submit" value="Submit">
</form>

Comment

PREVIOUS NEXT
Code Example
Php :: desactivar estilos globales wordpress 5.9 
Php :: laravel change error page to open in vscode 
Php :: Replace default WP search and dropdown placeholder 
Php :: push to aws instance ssh without using laravel 
Php :: Code of getting sum of digits 
Php :: laravel collection intersectKey 
Php :: php check if weekends 
Php :: lengthawarepaginator gives keys on page 2 
Php :: type of var php 
Php :: pass array from controller laravel with compact 
Php :: php accounting ledger 
Php :: Multiple databases user validation in Laravel 
Php :: user input in oop php 
Php :: FT_USER 
Php :: string replace in php 
Php :: laravel insert multiple rows from form 
Php :: $usr= $_POST["user"]; $pswd= $_POST["pass"]; 
Php :: itop cron.php 
Php :: 2.30 will display 2.3 in php 
Php :: Grab files matching particular file types in a directory 
Php :: Laravel array to string error 
Php :: remove public from url laravel 
Php :: Jolt transform specification input 
Php :: rendomly mix array position in php 
Php :: php pdo memory exhausted 
Php :: PHP strspn — Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask 
Php :: generateThumbnailRepresentations 
Php :: php -phone number verification 
Php :: laravel best practices tutorial 
Php :: Anzeige von Custom Post Types in den Kategorien und Tags 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =