-2
good evening guys I’m with a doubt which best pure php option or with javascript remembering that I have to take the past data to send to the bank in another. It is currently using java script. but I want to go by php how could I do it? it’ll be like this after
//<![CDATA[
window.onload=function(){
var btn = document.getElementById('btn');
btn.addEventListener('click', passar);
function passar() {
var valorA = document.getElementById("valorA");
var nome = document.getElementById("nome");
nome.value += (valorA.value + '\n');
};
}//]]>
<select name="valorA" id="valorA" size="3" multiple>
<option value="Gezer">Gezer</option>
<option value="João" selected>João</option>
<option value="Marcos">Marcos</option>
</select>
<button type="button" id="btn">passar valores</button>Nome:
<textarea id="nome" size="10"></textarea>
If you are going to pass via php, you will have to click on the "pass values" button, include the selected items in the database and then load the information in the inputs and update, using ajax you can do this without submitting the whole page.
– Lucas Fontes Gaspareto
vi da para fazer usando o Exploder e inplode separating by commas what do you think? Ai think that Listbox would go separately to the bank?
– gezer
Yes, use the implode(or Join) functions and explode, as you differentiate the values of the right and left in the database ?
– Lucas Fontes Gaspareto
You don’t asked that yesterday? If the answer did not answer your question there, why marked as resolved?
– Renan Gomes
because it was only javascript and here I want php I’m already understanding rs I saw that I would have to capitulate the data that are going par to listbox 2 and for that I would have to increase the script by creating another Function. but only this is with php. this only php.
– gezer
Do you want to pass the values from select to the textarea with PHP? Php runs on the server, no? I think that the only way would be to make a request for the server process the php code and generate the html you will use in the textarea. It seems impracticable a request just for that, but anyway...
– Renan Gomes
You can send the data via ajax in JSON, every click to PHP.
– Ivan Ferrer