Beginner PHP - Need Help with Null href or print array

Hi. I have a coding question. I am thinking this can be - hopefully fairly easily.

I have the following link set up and working with my database and php - but need a way to redirect - if the print $answerArray is null.

Code -

fb

The current code works great until a user does not have a FB web url to insert in the form I have provided.

I would like to just redirect viewers to a standard url when this happens.

So basically I am looking for something like this -

If the href is " (empty) " then redirect to “http://mydomain.com/missingsocial.php

Can this be done? Can someone give me a point in the right direction?

Thanks

[php]
if (empty($answerArray)) {
header(“Location: http://mydomain.com/missingsocial.php”);
}
[/php]

Remember, if anything has been sent to the browser before redirecting you’re going to get a “headers already sent error”.

Sponsor our Newsletter | Privacy Policy | Terms of Service