PHP - If variable is not empty echo some html code

0 votes

If a variable is not empty, I would like to display some HTML code; otherwise, I would like to display nothing.

I attempted this code, but it is ineffective:

<?php 
    $web = the_field('website');
    if (isset($web)) {
?>
       <span class="field-label">Website: </span><a href="http://<?php the_field('website'); ?>" target="_blank"><?php the_field('website'); ?></a> 
<?php
    } else { 
        echo "Niente";
    }
?>
Jul 24 in HTML by Ashwini
• 1,160 points
34 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In HTML

0 votes
0 answers

HTML if image is not found

In an HTML page, I have an ...READ MORE

Jul 26 in HTML by Tejashwini
• 1,660 points
9 views
0 votes
0 answers

What is the color code for transparent in HTML, is there any code as such?

I need to show a nav bar ...READ MORE

Jul 4 in HTML by Tejashwini
• 1,660 points
8 views
0 votes
0 answers

Inputting a default image in case the src attribute of an html <img> is not valid?

Is there any way to render a ...READ MORE

Jul 8 in HTML by Tejashwini
• 1,660 points
12 views
0 votes
0 answers

Inputting a default image in case the src attribute of an html <img> is not valid?

In the event that the src property ...READ MORE

Jul 12 in HTML by Ashwini
• 1,160 points
13 views
0 votes
0 answers

Chrome extension HTML Tree Generator is not working

I installed HTML Tree Generator to observe ...READ MORE

Jul 27 in HTML by Tejashwini
• 1,660 points
26 views
0 votes
1 answer

What is Html Web storage

With web storage, web applications can store ...READ MORE

answered Jan 31, 2020 in HTML by Niroj
• 82,740 points
757 views
0 votes
0 answers

PHP - If variable is not empty, echo some html code

I want to display some HTML code ...READ MORE

Jun 4 in PHP by Kichu
• 19,040 points
31 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
4,749 views
0 votes
1 answer

Vertically centering text in a div

Try this code: .smallUnitBox { ...READ MORE

answered Sep 3, 2018 in Blockchain by digger
• 26,720 points
271 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP