Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
the image needs to echo to the page and it cant. $log_username refers to the folder the user is named after . How can i reference this code so that the image displays on the page?
<img src="users/<?php echo $log_username.$main_image;?>/>
As i can understand you are missing / so it will be like this
<img src="user/<?=$log_username. '/' . $main_image;?>"/>
this:
<img src="users/<?php echo $log_username.$main_image;?>/>
should be:
<img src="users/<?php echo $log_username.$main_image;?>" />
notice the double quote in the end.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have some PHP that displays the users session name in the HTML and if the user is not logged in, then I would like it to display "User" instead.
Can I have an if statement in this case? I tried it myself but I got header errors.
This is what I've tried so far but each practical attempt just spits out more errors at me.
This is a different approach I have tried.
<?=$_SESSION['sess_user'] or ("User");?>!
<?php echo (isset($_SESSION['sess_user']) ? $_SESSION['sess_user'] : "User"); ?>
This will check if the session is set, if it is then echo the session, if it isn't then it will echo "User".
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I am trying to link to an external site.
where as $location outputs the URL (e.g. www.siteurl.com)
How do I make the outputted url a link and not just text
Thanks
Just echo out the anchor tags
echo 'Click';
Just try below code for other external site in new tab
echo 'Link name';
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I was wondering if you can change the colour of your print and echo text so that when it is displayed on your HTML page it's not simply in black? Cheers.
If you're doing this in html, always.
<?php echo "<span style='color:blue;'>blue text</span>"; ?>
If you're doing this in command line, it's a bit different. You'd need to create a library or find an existing one. Example: http://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/
Sure :
<?php
echo "<p style='color:blue'> Hello ! </p>";
?>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
Hello I have an array in PHP when I print it it is like that :
["Testing","Test2","New Testing Activity","The last five letters in the alphabet"]
is there a way to make the array like that :
{"Testing","Test2","New Testing Activity","The last five letters in the alphabet"}
I want this '{' instead of '['
Thanks
Maybe you want to do:
echo '{"' . implode('","', $arr) . '"}';
Demo: http://phpfiddle.org/lite/code/p57-0u4
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Getting these hyperlinks right and mixing HTML with PHP seems to be a constant source of sorrow for me. Whats wrong with this hyperlink?
echo '$suggestion[$ss_count]<br>;
it should be
echo ''.$suggestion[$ss_count].'<br>';
Within single quotes variables are not interpolated so you have to pull the link text out of the string literal.
try it ..!!
echo ''.$suggestion[$ss_count].'<br>';
you all missing the point.
JUST USE BACKSLASH