Hello ... The world HTLM / JAVASSCRIPT / PHP is totally new to me. As a beginner, I count on your help to develop a small project. Come on ...
I have an INDEX.HTML page that receives a value via URL. I was able to read this value using a function called CAPTURAPARAMETROURL () that I got in this forum. Now I need to open a page called CADASTRO.HTML when the user clicks REGISTRATION passing this value obtained by the function.
Who can help me?
The INDEX.HTML code is this:
<!DOCTYPE html>
<html lang="pt-br">
<head>
<title>MEU SITE</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->
<link rel="icon" type="image/png" href="images/icons/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<!--===============================================================================================-->
</head>
<body background="images/bg/bg2.jpg">
<div class="container-meusite">
<div class="wrap-meusite" >
<div class="meusite-form-title" style="background-image: url(images/title.png);">
</div>
<div class="container-meusite-form-btn">
<div class="container-meusite-form-btn">
</div>
</div>
<center><button class="meusite-form-btn">
<a href="cadastro.html?" style="color: #fff"><span>Inscrição</span></a>
</button>
</br>
<button class="meusite-form-btn" >
<a href="termo.html" style="color: #fff"><span>
Termos de uso
</span></a>
</button></center>
</br>
</div>
</div>
<script type="text/javascript" src="js/jquery.js"></script>
<script>
window.onload = CapturaParametrosUrl();
/* Captura parametros da URL com JS*/
function CapturaParametrosUrl() {
var url = window.location.href; //retorna a url da página
var res = url.split('?'); //tenta localizar o ?
if (res[1] !== undefined) {
var parametros = res[1].split('&'); //tenta localizar os & (pode haver mais de 1)
if (parametros[0] !== undefined) {
parametro0 = parametros[0].split('=');
parametro0 = parametro0[1];
var promocional = parametros[0]
document.getElementById('resultado').innerHTML = parametro0;
}
if (parametros[1] !== undefined) {
parametro1 = parametros[1].split('=');
parametro1 = parametro1[1];
document.getElementById('resultado').innerHTML += ', ' + parametro1;
}
if (parametros[2] !== undefined) {
parametro2 = parametros[2].split('=');
parametro2 = parametro2[1];
document.getElementById('resultado').innerHTML += ', ' + parametro2;
}
}
}
</script>
</body>
</html>