eliwedel eliwedel - 5 months ago 27
PHP Question

Check if $_POST exists

I'm trying to check whether a $_POST exists and if it does, print it inside another string, if not, don't print at all.

something like this:

$fromPerson = '+from%3A'.$_POST['fromPerson'];

function fromPerson() {
if !($_POST['fromPerson']) {
print ''
} else {
print $fromPerson
};
}

$newString = fromPerson();


Any help would be great!

Answer
if( isset($_POST['fromPerson']) )
{
     $fromPerson = '+from%3A'.$_POST['fromPerson'];
     echo $fromPerson;
}
Comments