eldergab
-
Total de itens
3 -
Registro em
-
Última visita
Posts postados por eldergab
-
-
Valeu lucas.js,
tentei montar o codigo mas deu erro,
vou colocar meu codigo inicial aqui para voce ver minha intensão no formulario,
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_conexao, $conexao);
$query_Recordset1 = "SELECT * FROM produtos";
$Recordset1 = mysql_query($query_Recordset1, $conexao) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<? //então, a minha intensão é por meio deste select escolher o nome do produto ?>
<select name="">
<?php
do {
?>
<option value="<?php echo $row_Recordset1['nome_prod']?>"><?php echo $row_Recordset1['nome_prod']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
<?php
mysql_free_result($Recordset1);
?>
<label for="textfield"></label>
<? // ai quando eu estiver escolhido o nome do produto la no select, o valor apareça aqui.?>
<input type="text" name="valor" id="valor">
desde já sempre agradeço,
-
Ola pessoal do script Brasil!
Sou novato no forum e na verdade esta é minha primeira que posto uma duvida,
estou montando um site em php onde tenho a página onde registro meus pedidos que fiz ao longo do dia com meus clientes, montei um formulario que busca informaçoes na tabela de produtos la no meu banco de dados, o problema é que eu não estou sabendo vincular os campos de forma que ao escolher o produto, possa aparecer no campo vazio o valor e a quantidade.
se alguém puder me dar alguma dica ficarei muito grato,
eu acredito que eu tenho que fazer atravez do if e do.
(Resolvido) Vincular campos no formulario
em PHP
Postado
valeu lucas.js
deu certinho aqui do jeito que eu precisava ,
obrigado pela dica!