HTML PHP if else statement [closed] - php

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have the following part of code inside my HTML body tag:
<?php if(1==2) { ?>
<a class="demage" href="xxxx.html">demage</a>
<a class="history" href="xxxx.html">history</a>
<?php } else { ?>
<a class="Sign In" href="login_page.html">Sign In</a>
<a class="Sign Up" href="register_page.html">Sign Up</a>
<?php } ?>
but it displays the 4 links in a row, not the last two as it is supposed to. What is wrong with the code?

Answered in comments, collective effort.
By default PHP will only evaluate/parse files containing PHP with the extension
.php

I don't see any error in the code the code is running as expected. (See the image attached.)
May be there's some problem with your php.

Related

problem using anchor button in server(cent os) [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
In my project i am using anchor button based on if else condition. In windows it's working perfectly.
HTML
<?php
$actionbutton = $row['status'] == 'success' ?
anchor('Users/getpdf/'.$row['appno'],'Generate Pdf') :
anchor('Users/validate/'.($row['appno']),'Pending') ;
?>
<td align="center"><?php $actionbutton;?></td>
after uploading in server (cents os) the button not displayed. how to solve this error?
On your first command, it assigns the value to your $actionbutton variable.
Your 2nd command, I think you want to echo the $actionbutton.
Maybe you want this <?=$variable?>.
So, in your case <?=$actionbutton?>
Codeigniter Documentation 👈 about alternative syntax.

Image Source to Include a PHP Input [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I am trying to create an image that changes dependent on the genre grabbed from an icecast server, I am pretty sure I have the base code correct I think I've just incorrectly inputted the PHP variable.
<?php
$stats = $core->radioInfo( "http://http://sc.onlyhabbo.net:8124/status-json.xsl" );
?>
<img src=http://www.habbo.com/habbo-imaging/avatarimage?user=<?php
echo $stats['genre'];
?>&action=std&direction=2&head_direction=2&gesture=sml&size=m&img_format=gif/>
is the full code. Have I inputted the PHP variable incorrectly
Where are the quotes in your Html?
<img src="http://www.habbo.com/habbo-imaging/avatarimage?user=<?php
echo $stats['genre'];
?>&action=std&direction=2&head_direction=2&gesture=sml&size=m&img_format=gif"/>
UPDATE EVERYBODY
This is now resolved, I decided to go down the CURL route for this, and at first it didn't work until my host raised our CloudLinux Process Limit. I am unsure what the actual issue with this code was, but the CURL route works fine. Thank you for any answers

How to Concatenate a PHP variable and a string [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
might be a very dumb question but i'm trying to make a html string with a php var and then html.. what the heck am I doing wrong?!? :(
$author_name = get_the_author(); ?>
<h4><?php $author_name;?> On-Demand Webinars</h4>
Thank you!
Just missed the echo.
<h4><?php echo $author_name;?> On-Demand Webinars</h4>
You missed "echo" statement
e.g
<?php echo $author_name;?> On-Demand Webinars
OR
<?=$author_name;?>

PHP echo button with on-click wont function well [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I have tried to echo the button, however the link just does not work, so I thinks something is wrong with the href link, please help.
echo "<input class='button_normal' type='button' value='entertainment' onclick='window.location..href=<Electronic and Entertainment Products.php>'>";
#james_91 The code below should do the trick:
<?php
echo "<input class=\"button_normal\" type=\"button\" value=\"entertainment\" onclick=\"window.location.href='Electronic and Entertainment Products.php'\">";
?>
I would advise against using spaces in your file names so use underscores instead maybe.
JS within a button within PHP works best with escaped quotation marks, you also had two dots in between location and href as commented by Fred -ii-

Using PHP inside a shortcode inside PHP... syntax issue [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Ok, I'm OK with PHP but not an expert. What's the correct syntax here?
I'm trying to pull in an Advanced Custom Field data INSIDE some PHP, which is INSIDE a shortcode.
I have an ACF field called: the_sub_field("google_doc_key")
<div><?php echo do_shortcode("[gdoc key='https://docs.google.com/spreadsheets/d/"'. the_sub_field("google_doc_key") .'"/edit' gid='0']"); ?></div>
Somethings not right here... any help is appreciated.
<div><?php echo do_shortcode("[gdoc key='https://docs.google.com/spreadsheets/d/'". the_sub_field("google_doc_key") ."'/edit' gid='0']"); ?></div>
Try that, you had the ' and " mixed up just before the_sub_field

Categories