Joe Bobby
Joe Bobby

Reputation: 2811

Fixing PHP Notices and Warnings?

I'm getting notices and warnings for this BMR Calculator PHP script, but I'm not sure whats causing them at all since these messages are only showing up in Firefox. Heres a screenshot

I added the php/html directly to my template file and turned php on for that file is that correct? Here is the php/html

Upvotes: 1

Views: 86

Answers (1)

Dave DeHaan
Dave DeHaan

Reputation: 166

Your issue is with:

$gender    = $_REQUEST['gender'];
$met       = $_REQUEST['metric'];

They're not defined in the query string or the posted data.

You could resolve the issue with an isset check.

# If gender is not set, set it to male by default.
$gender = isset( $_REQUEST['gender'] ) ? $_REQUEST['gender'] : 'male'; 

Upvotes: 2

Related Questions