0
I’m using the MDL(google) framework to make a registration system, and in the part of changing the information in the database, in passing the values through the url, only some are passed and others are not. In addition, the name and surname of do not appear in the form, although the url received both. Here is the code: page showing the data(clients.php):
$seleciona="select * from cadastro_clientes";
$sql=mysqli_query($con,$seleciona);
while ($reg=mysqli_fetch_assoc($sql)) {
echo "
<tr>
<td class=mdl-data-table__cell--non-numeric>$reg[nome]</td>
<td class=mdl-data-table__cell--non-numeric>$reg[endereco]</td>
<td class=mdl-data-table__cell--non-numeric>$reg[numero]</td>
<td class=mdl-data-table__cell--non-numeric>$reg[dada_comemorada]
</td>
<td class=mdl-data-table__cell--non-numeric>
<a href=form_edit.php?ru="
.urlencode($reg['nome']).
"&en=".urldecode($reg['endereco']).
"&nu=".urldecode($reg['numero']).
"&da=".urldecode($reg['dada_comemorada']).
">Editar</a></td>
</tr>";
}
?>
page that should show the data to change(form_edit.php):
<?php
include"conecta.inc";
$recebenome=$_GET['ru'];
$recebeendereco=$_GET['en'];
$numero=$_GET['nu'];
$data=$_GET['da'];
?>
<div class="page-content">
<form action="cadastrar.php" method="post" name="cadastro">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="sample3" name="nome" value=<?php echo $recebenome;?>>
<label class="mdl-textfield__label" for="sample3">NOME</label>
</div><br>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="sample3" name="endereco" value=<?php echo $recebeendereco;?>>
<label class="mdl-textfield__label" for="sample3">ENDEREÇO</label>
</div><br>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="sample3" name="numero" value=<?php echo $numero;?>>
<label class="mdl-textfield__label" for="sample3">NUMERO</label>
</div><br>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="sample3" name="data" value=<?php echo $data;?>>
<label class="mdl-textfield__label" for="sample3">DATA COMEMORADA</label>
</div><br>
<input type="submit" value="SALVAR" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent">
</form>
</div>
in the url the name and surname passes, but does not appear in the form, and the number and date give the error "Notice: Undefined index: nu in C: xampp htdocs Bjorn form_edit.php on line 5", but if I register a client without space, all appear normally. I don’t know why this, since I used urlencode :/
note, when I click on the client that is unwritten without separating the words by space:
now when I click the registered client with spaces separating the name and surname, and the address (note that the url takes the name and surname, but not the full address:
Undefined index: nu
means that$_GET['nu'];
this does not exist, which means that there is no parameter in the url (query string) fornu
– Isac
but why when I register a client without using the spaces the parameter is normally found?
– mazzu
Give an example of the two url’s, when it is caught and when it is not
– Isac
for example, if I register the name as "Jondoe", it takes all the data and normally shows, however, if register as "Jon Doe", with the use of spaces, the form only shows "Jon", although the url shows that the page received "Jon Doe"but in the number and date of birth do not appear, appears the error quoted above
– mazzu
In Edit is
<a href=form_edit.phpru=
. Shouldn’t be<a href=form_edit.php?ru=
. So I really suggest copying and pasting the url when it works and when it doesn’t work for the question so that the problem is clear and the same can be replicated.– Isac
Thanks for the suggestions updated the post by placing the images. I checked the code in the part you spoke, and it’s correct in my document, I don’t know why it’s wrong here, I must have accidentally deleted it
– mazzu
From what I see the URL of Edit is not being built with all values, but only the first 2. I started by confirming that the variable
$reg
has the values that is intended withprint_r($reg)
exactly before the Edit link– Isac
First: is the list displayed with all the right links? If any link is not right, are the ones with spaces? Second: details only work when the link is right or there are records that the link is right but details are not displayed?
– Woss