2
I apologize if I am redoing this question, I searched a lot and found nothing of the type.
My problem is that I have to send many variables using $_GET
using two pages
the following code is from pagina-cadastro.php
if($_GET['v1'] != '' || ($_GET['v2'] != '') || ($_GET['v3'] != '') || ($_GET['v4'] != '') || ($_GET['v5'] != '') || ($_GET['v6'] != '') || ($_GET['v7'] != '') ||
($_GET['v8'] != '') || ($_GET['v9'] != '') || ($_GET['v10'] != '')
$razaoSocial = $_GET['v1'];
$nomeFantasia = $_GET['v2'];
$cnpj = $_GET['v3'];
$email = $_GET['v4'];
$inscrEstadual = $_GET['v5'];
$inscrMunicipal = $_GET['v6'];
$cep = $_GET['v7'];
$rua = $_GET['v8'];
$numero = $_GET['v9'];
$complemento = $_GET['v10'];
} else {
$razaoSocial = "";
$nomeFantasia = "";
$cnpj = "";
$email = "";
$inscrEstadual = "";
$inscrMunicipal = "";
$cep = "";
$rua = "";
$numero = "";
$complemento = "";
and the page cadastrar.php
is
"<script> window.location = 'pagina-cadastro.php?&v1=".$razaoSocial."&v2=".$nomeFantasia . "&v3=".$cnpj . "&v4=". $email ."&v5=". $inscrEstadual . "&v6=".$inscrMunicipal . "&v7=" .$cep . "&v8=" .$rua . "&v9=" .$numero . "&v10=" .$complemento
I posted only 10 variables, but I have to do 150. How can I optimize my time not to write one by one?
You need to leave these variables with these names (
v1, v2...
)? I couldn’t put a more informative name?– Oeslei
GET requests have a maximum character limit. With these short names plus values and connectors (?, = and &) plus dominion, path etc. surprise would be if it worked. @Luizfernandosanches, there is some reason not to do via POST?
– Bruno Augusto
There’s a typo in the code, missing key
{
to open theif
.– Jorge B.
As @Brunoaugusto Augusto has already commented, what is the need to use GET and not POST?
– Marcelo de Andrade
I found a better solution to my problem, I will validate the fields with javascript and only release the button when the information is correct, because of the performance, I thank everyone who promptly helped me, thank you very much
– Luiz Fernando Sanches
@Luizfernandosanches even if you do it with javascript you must do the same on the server, in your case in php, because you should not trust what the client sends, someone can modify the request and send any information instead
– Leandro Godoy Rosa