drmlxgmqn18198265
drmlxgmqn18198265
2012-12-21 01:30

Php表达式 - 如果$ b有内容,则隐藏$ a

已采纳

I am trying to setup an expression for an href. Basically I want the url to change if the user adds a manual one in the backend.

I am using Advanced Custom Fields.

So I have 2 custom fields and would like custom field A to be cleared if field B has a url. Field A is always generated by the cms (like a randon link).

To explain better so you get the concept basically I want the user to be able to enter their manual link rather than the generated one if i am making my self clear.

So basically if Field B is true Clear field A which again is an href link.

I am pretty sure that this is a basic php statement just started with php :P

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dongzhong3688 dongzhong3688 9年前
    $a = $_POST['a'];
    $b = $_POST['b'];
    
    if ($b != '') $a = null;   
    
    点赞 评论 复制链接分享

为你推荐