Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Please tell me what's the exact function of this code
echo "<td>".$row['title']."</td>";
What does ">" sign does in that code ? I need exact and clear answer, so I appreciate help from you. Many thanks!!
It is the syntax of html. echo will print the string. when you are viewing the output in browsers, browsers need the html tags with the syntax.
Your echo statement is concatenating the strings before it prints. So '>' is the part of syntax of html tags.
example
<tag>text</tag>
the ">" is a completing the opening tag for the <a ...>. the code is really just building a string of html, and the ">" is part of the string, not a specific function.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have reworded this question please disregard original comments
UPDATED QUESTION
If I want to remove one or more characters in a textarea using php, how would I do this?
MY SOLUTION FOR A SINGLE INSTANCE
str_replace("http://","",$_POST['Website']);
How would I remove/replace multiple items or lower upper instances, i.e. HTTP//: http//: HTTPS:// https//: hTTps//: ?
You either should have fixed dictionary for allowed tags and good PCRE knowledge (remember to use lazy quantifiers) or (and this I would advise) use markdown syntax (there are js editors) and compile it in php to valid html.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I need to allow certain html tags (br,p and strong) and I have encountered this code.
(strip_tags($this->parent->content[$i]['text']), $this->parent->config, 'portal_mode_grid_news_text_length', '…').'</p>';
All I need is to allow those tags I have stated previously, but I don't know how to do it.
If you look at the documentation for strip_tags, it shows that the second parameter is "allowed tags", so an example of how to allow br, p and strong is like so:
$string = "Hello<br>";
echo strip_tags($string, "<br><br/><p><strong>");
Adding br and br/ together allows both types of line break as opposed to just one.
(strip_tags($this->parent->content[$i]['text'], "<br><br/><p><strong>"), $this->parent->config, 'portal_mode_grid_news_text_length', '…').'</p>';
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Right now I'm taking text from one form on a page to a separate page and form. I use $_GET to get the variable and just echo out the string between the textarea tags. The problem is formatting in the php seemed to be preserved. I got an if statement in there so it's pretty off.
I tried trimming the variable but that didn't do anything. Then I stripped out the PHP and typed free hand in between the tags. Is there a way to put text in a textarea without formatting?
Make sure your file ending is .php and that you properly open your PHP in the textarea, i.e.:
<textarea>
<?php if(isset($_GET['fieldName']) echo $_GET['fieldName']; ?>
</textarea>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am wondering why is that the $_SERVER['DOCUMENT_ROOT'] is not working in my code in echo with html option tag?
This is my sample:
echo "<option value='".$_SERVER['DOCUMENT_ROOT']."'/acces/login/validate?employee=".$login->employee()."&password=".$login->get_pwd()."'>LOGIN</option>";
It's generally a bad idea to reveal your document root, especially as there is no need for it in the browser. That aside, though, you should always look at the rendered HTML:
<option value='/path/to/doc/root'/acces/login/validate?employee=steve
&password=use plaintext and die'>LOGIN</option>
(Line wrap added to avoid ugly horizontal scrollbar)
See that extra ' after the doc root? That'll be your problem.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
here is what i am trying to do
$store='something.com';
echo '<div><h3>click on</h3><a href='.$store.'>host</a></p></div>';
what it output is
something.com
instead it should use something.com as link and output need to be host.
try for sometime to do it my own but havn't achieved any success.
This code will help you out:
<?php
$store='something.com';
echo '<div><h3>click on</h3>host</p></div>';
Note the double quotes (") between the string concatenation (') this is needed by the browser to make render the proper href element.
I am agree with the Answer of Ma'moon and it is right.
Php code does not work inside the single quotes ' ', so its required to place code inside the double quotes " ".
You can also use following method instead ↓
$store='something.com';
echo "<div><h3>click on</h3><a href='$store'>host</a></p></div>";