html - text in a textarea without formatting? [closed] - php

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>

Related

Get only all the visible text from a url [closed]

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 5 years ago.
Improve this question
I want to get all the visible text from a url. I need to clear all html code and get plain text.
The process does not have to be perfect, but I would like the text to be as clean as possible.
Do you know any way to make it relatively simple?
Thanks!
Javi.
Have a look at strip_tags function.
strip_tags — Strip HTML and PHP tags from a string
It may do the job.
You can get url the value of the query string using $_GET['the names in there']. and use strip_tags to get only the text.
function get_url(){ return $_GET['name userd'];}
and use something like this

Displaying text area input within something other than text area [closed]

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 7 years ago.
Improve this question
I am working on a form completion view that needs to be easily copied. One of the inputs is a that displays multiple lines. So person can type out something that looks like this.
Dear Bob,
I am here to do this.
Thank you
SirRahal
I then take that data and store it into a database as varchar(1500) latin1_swedish_ci. The issue is that when I try to display this data in anything other than a it combines all the lines into 1. Example the not above would display like this:
Blockquote
Dear Bob, I am here to do this. Thank you SirRahal
The reason why I can't use a textarea to display it is because it doesn't copy and paste friendly.
Questions:
1) Is there another way of displaying this correctly?
2) Are there hidden characters in the string that I can use to identify in php and parse the text?
This code does work but I can't use a textarea:
<textarea>
<?php echo $model->description;?>
</textarea>
I believe you need to add nl2br when you output, e.g.
<?php echo nl2br($model->description);?>
Use CSS, and set white-space: pre on the container of the text.

Using PHP script to replace a field in HTML form [closed]

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 7 years ago.
Improve this question
I need to use PHP script to replace the 7th character of a HTML form input Field.
Eg.
A234591Q
To become
A23459IQ
Replacing number1 with I letter.
The problem is that I don’t have acess to php script file, so I need to do it in HTML page as customer types data, or at submit time.
Moises
If you have the JQuery library linked on your page, then you can try the following.
First you should give your input an ID e.g <input type="text" id="useranswer">
Then set the onsubmit property of your HTML form to:
<form action="" onSubmit="replaceAt(7,$('#useranswer').val())">
Then define the replaceAt Function.
function replaceAt(index,word){
newWord=word.substr(0,index) + 'l' + word.substr(index+1);
$('#useranser').val(newWord);
}
I have just given the answer for your question as it is not clear how you plan to implement it without access to the source

How do I open an url in a new tab via php? [closed]

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
Go!
like this code but using php thanks
You can change location with php:
header("location:somewhere.php");
but in the same tab - php will not tell the browser to open it in new tab. This must be done by javascript after reloading by the header function, but you will not know if it will open in new tab or in new window anyway - it is up to the browser settings!
Remember that you cannot output even single character to the browser (no echo, no html tags) before calling header function.
I'm not really sure that's what you want it, but it is what I understood.
<?php
echo 'Go!';
?>
Did you know you can name a file .php and still have php and html code on it? you just have to put at the start and end of the code and then just write rest on html outside of those code brackets.

i want to pass a string from one input box to another in different page [closed]

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 want to pass a string from an input box that after submition automatically goes to different page and the string gets copied in the input box in that page .the Language I am using is php.
In your second page, you need to read the incoming value from the input box and include it in the output (which includes the second input box). Do not forget to pass the value of the variable through htmlspecialchars, since you are outputting it as part of your HTML.
So the code for the second page would look something like this:
$incoming = $_REQUEST['name_of_input_box_1'];
echo '<input type="text" name="name_of_input_box_2" value="'
.htmlspecialchars($incoming).'" />';

Categories