So I have a simple form here but I can’t seem to get it to work. The user should enter their name and profession - it then goes to test.php which will store the values in variables in functions so I can reuse the code when the form get bigger but if I can only return one variable how do I get final.php to print out the values in the previous form? I tried to include the functions but no luck I think im missing something major or something simple - here’s what I got:
<html>
<head>
</head>
<body>
<form action="test.php" method="post">
Name: <input type="text" size="12px" name="name" />
Profession <input type="text" size="12px" name="job" />
<br />
<input type="submit" />
</form>
</body>
<?php
function yourName()
{
$name = $_POST['name'];
$job = $_POST['job'];
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\\\');
header("Location: http://$host$uri/final.php");
}
?>
<?php include('test.php'); ?>
<html>
<head>
</head>
<body>
<?php echo $name ?>
<?php echo $job ?>
</body>
</html>