Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Im not 100% I have an answer, but I cant find comment anywhere so I will joust post here.</p> <ol> <li>You cant access PHP variables from Javascript. PHP is running on the server, and Javascript is inside users browser.</li> <li>Javascript cant get $_GET and $_POST variables like PHP.</li> </ol> <p>Now what you can do is this, with JavaScript you can get document.location string that holds your current URL. And you can brake that URL into parts. To do that use this function:</p> <pre><code>&lt;script&gt; var $_GET = {}; document.location.search.replace(/\??(?:([^=]+)=([^&amp;]*)&amp;?)/g, function () { function decode(s) { return decodeURIComponent(s.split("+").join(" ")); } $_GET[decode(arguments[1])] = decode(arguments[2]); }); alert($_GET['someVar']); // This will alert content of someVar </code></pre> <p></p> <p>Now you can use $_GET['vars'] to get your URL vars.</p> <p>And then you dont use PHP to echo variable content, you joust prepare your URL so it holds variables you want to insert into your form.</p> <p>So you do something like this:</p> <pre><code>&lt;script type="text/javascript"&gt; document.getElementById('text-386').value = $_GET['urlVar']; document.getElementByName('radio-30').checked = "checked"; document.getElementById('d-o-b-d').value = $_GET['urlVar']; document.getElementById('d-o-b-m').value = $_GET['urlVar']; document.getElementById('d-o-b-y').value = $_GET['urlVar']; &lt;/script&gt; </code></pre> <p>So as you can see, JavaScript takes variables from URL, using function $_GET you wrote and it dosent needs PHP. And you can use PHP to generate URLs you need, so they contain variables you can get using $_GET javascript function.</p> <p>Hope this answers your question.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload