MDanz Posted November 5, 2009 Share Posted November 5, 2009 i have a hyperlink echo "<a href='uinfo.php?topic=$search&submit=Go!' style='text-decoration: none';> how do i do if $search is blank then the link is this echo "<a href='uinfo.php'> Quote Link to comment https://forums.phpfreaks.com/topic/180452-solved-help-with-if-statement/ Share on other sites More sharing options...
mikesta707 Posted November 5, 2009 Share Posted November 5, 2009 echo (!empty($search)) ? "<a href='uinfo.php?topic=$search&submit=Go!' style='text-decoration: none';>" : "<a href='uinfo.php'>"; this is using the ternary operator though. you could use an if statement if you wanted... Quote Link to comment https://forums.phpfreaks.com/topic/180452-solved-help-with-if-statement/#findComment-951972 Share on other sites More sharing options...
MDanz Posted November 5, 2009 Author Share Posted November 5, 2009 thx again Quote Link to comment https://forums.phpfreaks.com/topic/180452-solved-help-with-if-statement/#findComment-951979 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.