开发者

PHP if statment question

I have a simple question. So I have this code in my php file:

if(empty($_POST['height'])) { 
$width = '385';
}

is it possible to do something like this?

if value of ($_POST['height'开发者_StackOverflow社区] is 'height' then $width ='385'; instead of if empty?


Do you mean;

if (!empty($_POST['height']) && $_POST['height'] == 'height') {
    $width = '385';
}

Update

Based on the comment, the solution would be:

if (array_key_exists('height', $_POST) && $_POST['height'] == 'height') {
    $width = '385';
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜