0
I will pass here every page for an analysis and know how I send the value of the input type to the other page. I thank you already!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form action="carrinho_vitrine.php" method="post">
<!--INFORMAÇÕES DO PRODUTO -->
<table id="tb_vitrine" border="1px solid black" bordercolor="f2f2f2" width=90% align="center" class="bordasimples">
<caption><h4>:: Informações do Produto ::</h4></caption>
<?php
if(isset($_POST['cbo_vitrine'])){
//Conecta o banco de dados e traz as informações dos produtos...
include("conexao.php");
$pdo=conectar();
try{
$refer = $_POST['cbo_vitrine'];
//Buscando dados..
$sql=$pdo->prepare("SELECT * FROM vitrine_1 WHERE refer = '$refer'");
$sql->bindParam(':id', $_GET['id'], PDO::PARAM_INT);
$sql->bindParam(':refer', $_GET['refer'], PDO::PARAM_STR);
$sql->bindParam(':modelo', $_GET['modelo'], PDO::PARAM_STR);
$sql->bindParam(':cor', $_GET['cor'], PDO::PARAM_STR);
$sql->bindParam(':numeracao', $_GET['numeracao'], PDO::PARAM_STR);
$sql->bindParam(':unit', $_GET['unit'], PDO::PARAM_STR);
$sql->execute(array('refer' => $refer));
//criando o cabeçalho na tabela
echo '<th>' .'REFERÊNCIA'. '</th>';
echo '<th>' .'MODELO'. '</th>';
echo '<th>' .'COR'. '</th>';
echo '<th>' .'NUMERAÇÃO'. '</th>';
echo '<th>' .'QTDE'. '</th>';
echo '<th>' .'PREÇO UNIT.'. '</th>';
//loop
while($linha=$sql->fetch(PDO::FETCH_ASSOC)){
//pegando o dado do campo = refer
$id = $linha["id"];
$refer = $linha["refer"];
$modelo = $linha["modelo"];
$cor = $linha["cor"];
$numeracao = $linha["numeracao"];
$qtde = "1";
$unit = $linha["unit"];
//montando a table...
echo '<tr>';
echo '<td>' . $refer . '</td>';
echo '<td>' . $modelo . '</td>';
echo '<td>' . $cor . '</td>';
echo '<td>' . $numeracao . '</td>';
echo '<td>' . $qtde . '</td>';
echo '<td>' . $unit . '</td>';
echo '</tr>';
};
echo'<td height="10"><a href="carrinho_vitrine.php?acao=add&id='.$id.'">
<img src="img/comprar-1.png" name="add_car_vitrine" id="add_car_vitrine" height="50" width="120" align="center" title="Adicionar ao Carrinho" value="add_car_vitrine"></a></td>';
//fechando a conexão
$pdo = null;
}
catch(PDOExcception $erro){
echo $erro->getmessage();
}
}
?>
</table>
Sua numeração:
<input type="text" value="" id="numero" maxlength="2" placeholder="Digite" size="3" align="center">
</form>
</body>
</html>
With jquery I’m testing and capturing the input type value.
$(document).ready(function(){
$("#add_car_vitrine").click(function(){
var valor = $("input[name=numero]").val();
if($("#numero").val()==""){
alert("Digite sua numeração!");
return false;
}
//mostramos o valor com alert()
//alert(valor);
});
});
Can you mount an Ajax and send the value of this input type to the other page? Can someone please post an example? Grateful.
Nothing worked, unfortunately... What I noticed is that sending this way: <a href="carrinho_vitrine.php? acao=add&id='. $id. '">, then I am enviand via GET, Correct?
– xavier
In this inpu type -->> Your numbering: <input type="text" value="" id="number" maxlength="2" placeholder="Type" size="3" align="center">, I want to send it to the other page. Note that this data: echo '<td>' . $numeration . '</td>'; it comes from the base. When I type the new value into the input type, I am changing it by uploading it to the other page. Only this does not happen.
– xavier