3
Answers

My input value form doesnt appear to another input form page

Hi Sirs;

<!-- first page -->

<form action="202_2pass_input_form_to_another_input_form.php" method="post">

<label for="myInput">Enter Value:</label>

<input type="text" id="myInput" name="inputValue">

<button type="submit">Go to Page 2</button>

</form>

<!-- second page -->

<?php

$receivedValue = "";

if (isset($_POST['inputValue'])) {

$receivedValue = htmlspecialchars($_POST['inputValue']); // Sanitize input

}

?>

<!DOCTYPE html>

<html>

<head>

<title>Page 2</title>

</head>

<body>

<form action="202_2pass_input_form_to_another_input_form.php" method="post">

<label for="targetInput">Received Value:</label>

<input type="text" id="targetInput" value="<?php echo $receivedValue; ?>">

</form>

</body>

</html>

Answers (3)