-1
I’m having a problem printing a value of a php variable into an html form.
I printed without spaces, but in the table the data comes normal from the database.
Example: Testing test b
he prints Testeb in the input.
I just want it to print out the way it’s in the bank.
<html>
<head>
<link href="./estilo/estilo.css" rel="stylesheet">
<script lang="javascript" src="./javascript/jquery.min.js" ></script>
<script lang="javascript" src="./javascript/validacao.js" ></script>
<script lang="javascript" src="./javascript/busca.js" ></script>
<meta charset="UTF-8">
</head>
<body>
<header class="menu">
<div class="menu-container">
<h1> Search</h1>
<p id="texto"></p>
</div>
</header>
<?
$editar = $_GET['id'];
$sql = "select * from cliente where i_cliente = $editar ";
require_once "conexao.php";
$c = new conexao();
$edicao_dados = mysqli_query($c -> conexao(),$sql);
?>
<?php while($alterar = mysqli_fetch_array($edicao_dados)){?>
<form class="formulario" id="pesquisa" method="POST" action="incluir.php" name="formulario" enctype="multipart/form-data">
<p>
<?php $nome = $alterar[1];
?>
<label>Nome</label><br><input type="text" name="nome" class="entrada-dados" value="<?php echo $nome.'\t'?>">
<span class="hint">Digite por exemplo:Jonatas de Sá silva</span>
</p>
<p>
<label>CPF</label><br><input value="<?php echo $alterar[3]?>" class="entrada-dados"type="text" name="cpf" >
<span class="hint">Digite por exemplo:161.306.887-50</span>
</p>
<label>CNPJ</label><br><input type="text" name="cnpj" class="entrada-dados" value="<?php echo "{$alterar[2]}"; ?>"><br>
<button type="button" onclick="validar()"class="cadastrar1-btn" name="enviar3">Cadastrar33</button>
<!-- <input type="submit" onclick="validar()" class="cadastrar-btn" name="enviar" value="Cadastrar" >-->
<input type="submit" onclick="validar()" class="alterar-btn" name="alterar" value="Alterar" ><br>
<input type="file" onclick="validar()" class="importar-btn" name="alterar" value="Importar dados..." >
<hr>
<input name="id_cliente" type="hidden " value="<?php echo $alterar[0]?>"></input><br>
<input type="search" class="pesquisa" class="buscar-dados" placeholder="O que deseja buscar??" >
<select class="opcao" >
<option name="nome">nome</option>
<option name="CPF">CPF</option>
<option name="CNPJ">CNPJ</option>
</select>
<a class="btn-aparecer">Buscar</a>
<table border="1px solid" class="tabela clear" width="600px" height="300px">
<tr>
<th>Nome</th>
<th>CNPJ</th>
<th>CPF</th>
<th>Ação</th>
<tr>
<?php
/*
function excluirCadastro(){
$excluir = "delete cliente where i_cliente = $id";
$excluido = mysqli_query($excluir);
if($excluido != 0){
echo "Erro ao Excluir";
}else{
echo "Excluido com Sucesso!";
}
}
*/
//busca todos dados para fazer regaginacao
require_once "conexao.php";
$c = new conexao();
$busca = "select * from cliente";
$total_registros_pagina = 20;
$pagina = $_GET['pagina'];
if(!$pagina){
$pc = "1";
}else{
$pc = $pagina;
}
//Se não for definida o valor da página sera atribuida 1 a mesma.
//Determinar valor inicial das buscas litimitadas.
//Verifica ou retorna o numero de registros no banco.
$inicio = $pc - 1;
$inicio = $inicio * $total_registros_pagina;
$limite = mysqli_query($c -> conexao(),"$busca LIMIT $inicio,$total_registros_pagina");
$todos = mysqli_query($c -> conexao(),$busca);
$tr = mysqli_num_rows($todos);
$tp = $tr / $total_registros_pagina;
//criando a visualização
?>
<?php while($dados = mysqli_fetch_array($limite)){ ?>
<td><?echo $dados[1]?></td>
<td><?echo $dados[2]?></td>
<td><?echo $dados[3]?></td>
<td><a href='cadastro.php?id=<?echo $dados[0]?>&nome=<?php $dados[1]?> &acao=editar &cpf=<?$dados[3]?>' > <img src='./icons/lapis1.png'></a>-<a id="excluir" href='excluir.php?excluir=<?echo $dados[0]?>'> <img src='./icons/lixeira.png'>
</a></td>
</tr>
<?}?>
</table>
<div class="clear"></div>
<?}?>
<?
$anterior = $pc - 1;
$proximo = $pc + 1;
$id_atual = $_GET['id'];
if($pc>1){
echo "<a class='btn-anterior' href='?id=$id_atual&pagina=$anterior'><-Anterior</a>";
}
echo "|";
if($pc<$tp){
echo "<a class='btn-proximo' href='?id=$id_atual&pagina=$proximo'><-Proximo</a>";
}
?>
</form>
<table class="tabelaPesquisa" width="600px" align="center" border="1px solid black">
<th>Pesquisa</th>
<tr>
<ul>
<td> <li class='resultado'></li></td>
</ul>
</tr>
<tr>
<?
//Botoes proximo e anterior;
?>
</tr>
</table>
<?
?>
</body>
</html>
It wasn’t clear your question, better organizing your code I can help you better
– Mauro Rocha
The value coming from the bank is being printed without space or everything together MAUROROCHA EU QUERO ESPACO between the name and the over, Uro rock.
– BlackCode
Blackcode and @Rodrigoalves users. Stack Overflow is not a forum, we are a site of questions and answers, do not use the space of answers to weave dialogues.
– Augusto Vasques
Share your code, or project, either through Git or online so we can see what you’re doing, I’m willing to help you solve it. then put the solution here.
– Mauro Rocha