2
I am here with a difficulty, I am receiving a value that comes from a JQUERY request to be presented in a form input, with the code:
HTML
<input type="text" id="valor">
With this TAG I can recover the value I want in HTML, my problem now is how I will pass it to a PHP variable.
I already tried using this method, follow the code:
JAVASCRIPT
var valor = document.getElementById("valor").value;
Next in PHP I try to recover it this way, follow the code:
PHP
$varphp = "<script>document.write(valor)</script>";
But I couldn’t, what can I do to fix the code? Because I need the code that appears in the form input tag to convert to a PHP variable.
It is already passed 1x by means of a form, but as I want to open 2 modal windows I want to recover the data from 1 window, so this <input> already contains the javascript variable I want, my problem now is to be able to convert this value to PHP, I know it’s a weird procedure to do, but what I’m doing is really complex, so I have to cut back somehow, because there are a lot of lines of code that I would have to change!
– Luis
Do you already have the value in your JS? then make another request (maybe AJAX) for another PHP resource.
– user6406
First step is to forget about this idea of yours. PHP Scripts don’t know what JS is.
– user6406