How to add name to every page of application (PHP)

ibmethatswhoib

Elite Member
Joined
Feb 17, 2011
Messages
1,567
Reaction score
1,171
So my company has an online application built in PHP and people fill it in and it sends it to a database. Well the company asked me to add the applicants name to every page somewhere, I'm guessing so when they print them out it will have the name on every page of the application. I'm not too good with PHP is there a way to do that?

 
<?php echo $name;?>

that prints a variable to the screen. Simply replace $name with the proper variable holding the name..
 
If it's about a form, you can have access to the name variable from the form by using the $_POST or $_GET (depending on what method you are using to send the info) or $REQUEST['name'].
Then you just need to echo those values :
PHP:
<?php echo $_POST['name']; ?> 
<?php echo $_GET['name']; ?>

Now, to display variables that are sent by a user in a form you can make those values sticky like this:

PHP:
<?php if (isset($_POST['name']) && (!empty($_POST['name'])) echo $POST['name']; ?>

That line can be reduced by making a custom function and detect wether a variable was submitted or not and just outputing the value....but everything depends on your logic and how you are sending the data :)
 
Back
Top