In test2.php, use the following code to get the name:
if ( ! empty($_POST['name'])){ $name = $_POST['name']); }
When you create the following page, use the value of $name to populate the form field:
Name: <input type="text" name="name" id="name" value="<?php echo $name; ?>"><br/>
However, before doing this, be sure to use regular expressions to verify that the name $ contains only valid characters, such as:
$pattern = '/^[0-9A-Za-zÁ-Úá-úàÀÜü]+$/';//integers & letters if (preg_match($pattern, $name) == 1){ //continue } else { //reload form with error message }
source share