I have a snippet below that uses $name to display a person’s name. If the name isn’t there it says No name added. How can i make it so that instead of saying that variable will display nothing at all?
$name = "Name - $variablefromdatabase";
// If $name is empty
if (empty($name)) {
$name = "No Name added";
}
If I understood the question correctly, if the user has no name set, nothing should be displayed, else it’s see to
Name - {their name}