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'> 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... 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 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
Archived
This topic is now archived and is closed to further replies.