Foros del Web » Creando para Internet » Diseño web »

[SOLUCIONADO] Página Web con envío de datos por Dreamweaver

Estas en el tema de Página Web con envío de datos por Dreamweaver en el foro de Diseño web en Foros del Web. Hola a todos, soy nuevo en este foro y gracias de antemano a quien quiera ayudarme! Trataré de ser lo más breve posible y de ...
  #1 (permalink)  
Antiguo 04/11/2015, 13:38
 
Fecha de Ingreso: noviembre-2015
Ubicación: Neptunia, Canelones
Mensajes: 12
Antigüedad: 8 años, 5 meses
Puntos: 0
Pregunta Página Web con envío de datos por Dreamweaver

Hola a todos, soy nuevo en este foro y gracias de antemano a quien quiera ayudarme!

Trataré de ser lo más breve posible y de explicarme lo mejor que pueda. Estoy realizando una Web de compras bastante sencilla, en la cual el visitante pude registrarse, iniciar sesión con sus datos, ver un catálogo de productos y "comprar" el producto que quiera de ese catálogo. Estoy utilizando Dreamweaver, WAMP para correr el servidor de pruebas (con phpMyAdmin para crear las tablas de la base de datos)y todo me está funcionando bien de bien, a excepción de una parte.

Mi problema es que, cuando el visitante (una vez logueado en el sitio) intenta comprar un artículo de la tienda (haciendo clic sobre un botón de compras de la página de artículos), el sitio lo redirecciona a otra página en la que se le pide que rellene algunos datos (como su nombre, dirección, teléfono, etc.). Ahora bien, lo que quiero es que desde la página del catálogo se pasen a esta página algunos datos como por ejemplo el nombre del artículo que está comprando el visitante, su número de Id (del artículo), el nombre del usuario registrado y el precio del producto, para que el visitante no tenga que digitarlos otra vez.

Estuve probando con variables por URL, pero no me funcionó. Aclaro que el sitio trabaja con tres tablas: "clientes", donde se almacenan los datos de los usuarios registrados, "productos", donde están los datos de los productos que muestra el catálogo, y "ventas", que es la tabla que quiero que se vaya rellenando cuando el usuario compra algún artículo. No domino mucho el lenguaje PHP, ya que soy más bien diseñador, pero este sitio lo estoy creando más bien para unas clases de diseño Web, que sería la parte final del curso, en la cual se ve algo de páginas dinámicas, siempre utilizando Dreamweaver...

Desde ya agradecería de sobremanera a quien me pudiera guiar en este problema que ya hace tiempo estoy intentando solucionar.
  #2 (permalink)  
Antiguo 04/11/2015, 15:48
Avatar de xfxstudios  
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: Página Web con envío de datos por Dreamweaver

lo que pides es facil y dificil dependiendo de tu nivel como programador, y en tal caso en php y otras cositas, ademas va a depender de como este estructurado tu codigo y de coo estas pasando las variables al formulario final, debes explicar cual es la estructura que sique la compra, que archivos intervienen y cual es el codigo que lo ejecuta, es este ultimo el que debes colocar aqui para poder ayudarte haciendole el estudio
__________________
[email protected]
HITCEL
  #3 (permalink)  
Antiguo 04/11/2015, 18:03
 
Fecha de Ingreso: noviembre-2015
Ubicación: Neptunia, Canelones
Mensajes: 12
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Página Web con envío de datos por Dreamweaver

Muchas gracias xfxstudios por tu respuesta. Como te comenté antes, no tengo mucha idea de programación en php. Te cuento que todo el sitio está hecho en dreamweaver, con conexión a una base de datos (llamada empresa) hecha en phpMyAdmin utilizando WAMP. Las tablas de esta base son tres: una que guarda los datos de los usuarios registrados (denom clientes), otra que guarda la info de los productos (productos) que se ofrecen y una tercera que guarda la info de la compra (tabla ventas). Las páginas del sitio son: una pag de portada, una pag que muestra los productos (en un catalogo), una pag para registrarse, una para iniciar sesión y otra para confirmar la compra de un producto. Todo me funciona bien. El problema radica en que, una vez registrado el usuario, cuando éste compra un producto de la pag catalogo (haciendo clic en un botón etiquetado como COMPRAR) quiero que se muestre un form de ingreso para la tabla ventas, en la cual se le pida al usuario su nombre, dirección, teléfono e e-mail, pero que en dicho form se muestre el nombre del producto que se está comprando, la id del producto y la id del cliente. Estos datos se muestran en el catalogo de compra (que a su vez los muestra mediante una tabla dinámica desde un recordset), siendo éstos los registros de la tabla productos. Mil gracias de nuevo por la respuesta... en el siguiente post te paso el codigo de las dos paginas (catalogo y ventas)
  #4 (permalink)  
Antiguo 04/11/2015, 18:04
 
Fecha de Ingreso: noviembre-2015
Ubicación: Neptunia, Canelones
Mensajes: 12
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Página Web con envío de datos por Dreamweaver

aquí va el código de la pág catalogo:

<?php require_once('Connections/empresa.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);

$logoutGoTo = "index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?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;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_empresa = 1;
$pageNum_empresa = 0;
if (isset($_GET['pageNum_empresa'])) {
$pageNum_empresa = $_GET['pageNum_empresa'];
}
$startRow_empresa = $pageNum_empresa * $maxRows_empresa;

mysql_select_db($database_empresa, $empresa);
$query_empresa = "SELECT * FROM productos";
$query_limit_empresa = sprintf("%s LIMIT %d, %d", $query_empresa, $startRow_empresa, $maxRows_empresa);
$empresa = mysql_query($query_limit_empresa, $empresa) or die(mysql_error());
$row_empresa = mysql_fetch_assoc($empresa);

if (isset($_GET['totalRows_empresa'])) {
$totalRows_empresa = $_GET['totalRows_empresa'];
} else {
$all_empresa = mysql_query($query_empresa);
$totalRows_empresa = mysql_num_rows($all_empresa);
}
$totalPages_empresa = ceil($totalRows_empresa/$maxRows_empresa)-1;

$queryString_empresa = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_empresa") == false &&
stristr($param, "totalRows_empresa") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_empresa = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_empresa = sprintf("&totalRows_empresa=%d%s", $totalRows_empresa, $queryString_empresa);
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<style type="text/css">
.Estilo1 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-style: italic;
color: #0000FF;
}
.Estilo2 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 24px;
font-weight: bold;
font-style: italic;
color: #FF0000;
}
.Estilo3 { color: #FFFFFF;
font-style: italic;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
}
.Anterior {
color: #F00;
}
.Siguiente {
color: #F00;
}
</style>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>

<body onload="MM_preloadImages('button1_2.gif','button2_ 2.gif','button3_2.gif','button4_2.gif','button5_2. gif','button7_2.gif','button6_2.gif')">
<table width="931" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="357" rowspan="2"><img src="fastimport.jpg" alt="fastimport" width="368" height="137" /></td>
<td width="109" height="94"><div align="center"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','button1_2.g if',1)"><img src="button1.gif" width="99" height="21" id="Image4" /></a> </div></td>
<td width="117"><div align="center"><a href="catalogo.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','button2_2.g if',1)"><img src="button2.gif" width="103" height="30" id="Image5" /></a> </div></td>
<td width="116"><div align="center"><a href="ingreso_clientes.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','button3_2.g if',1)"><img src="button3.gif" width="103" height="30" id="Image6" /></a> </div></td>
<td width="117"><div align="center"><a href="login.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','button4_2.g if',1)"><img src="button4.gif" width="103" height="30" id="Image7" /></a> </div></td>
<td width="115"><div align="center"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','button5_2.g if',1)"><img src="button5.gif" width="103" height="30" id="Image8" /></a> </div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><em><strong>USUARIO:</strong></em></td>
<td><?php
if(isset($_SESSION['MM_Username'])){
echo $_SESSION['MM_Username'];
}
?>&nbsp;</td>
<td><a href="<?php echo $logoutAction ?>" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','button7_2.g if',1)"><img src="button7.gif" width="99" height="21" id="Image9" /></a></td>
</tr>
</table>
<table width="931" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#0000CC">&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<div align="center">
<?php do { ?>
<table width="490" border="0" align="center">
<tr>
<td width="179"><strong>Número ID:</strong></td>
<td width="301"><?php echo $row_empresa['Id']; ?></td>
</tr>
<tr>
<td><strong>Foto:</strong></td>
<td><img src="<?php echo $row_empresa['Foto']; ?>" alt="foto" /></td>
</tr>
<tr>
<td><strong>Nombre:</strong></td>
<td><?php echo $row_empresa['Nombre']; ?></td>
</tr>
<tr>
<td><strong>Descripción:</strong></td>
<td><?php echo $row_empresa['Descripcion']; ?></td>
</tr>
<tr>
<td><strong>Precio:</strong></td>
<td><?php echo $row_empresa['Precio']; ?></td>
</tr>
<tr>
<td><strong>Fecha de ingreso:</strong></td>
<td><?php echo $row_empresa['Fecha']; ?></td>
</tr>
<tr>
<td><strong>Stock:</strong></td>
<td><?php echo $row_empresa['Stock']; ?></td>
</tr>
<tr>
<td><div align="center">
<?php if ($pageNum_empresa > 0) { // Show if not first page ?>
<strong class="Anterior"><em><a href="<?php printf("%s?pageNum_empresa=%d%s", $currentPage, max(0, $pageNum_empresa - 1), $queryString_empresa); ?>">&lt;&lt; Anterior</a></em></strong>
<?php } // Show if not first page ?>
</div></td>
<td><div align="center">
<?php if ($pageNum_empresa < $totalPages_empresa) { // Show if not last page ?>
<strong class="Siguiente"><em><a href="<?php printf("%s?pageNum_empresa=%d%s", $currentPage, min($totalPages_empresa, $pageNum_empresa + 1), $queryString_empresa); ?>">Siguiente &gt;&gt;</a></em></strong>
<?php } // Show if not last page ?>
</div></td>
</tr>
</table>
<?php } while ($row_empresa = mysql_fetch_assoc($empresa)); ?>
</div>
<p align="center"><a href="ventas.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','button6_2.g if',1)"><img src="button6.gif" width="103" height="30" id="Image" /></a> </p>
<p>&nbsp; </p>
</body>
</html>
<?php
mysql_free_result($empresa);
?>
  #5 (permalink)  
Antiguo 04/11/2015, 18:10
 
Fecha de Ingreso: noviembre-2015
Ubicación: Neptunia, Canelones
Mensajes: 12
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Página Web con envío de datos por Dreamweaver

Y aquí el código de la pág ventas (que es pag de acceso restringido), 1ª parte:

<?php require_once('Connections/empresa.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);

$logoutGoTo = "index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "error_ingreso.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?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;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO ventas (Factura, Nombre, Telefono, Direccion, Producto, IdCliente, IdProducto, FormaPago, Cheque, Cantidad, Total) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Factura'], "int"),
GetSQLValueString($_POST['Nombre'], "text"),
GetSQLValueString($_POST['Telefono'], "text"),
GetSQLValueString($_POST['Direccion'], "text"),
GetSQLValueString($_POST['Producto'], "text"),
GetSQLValueString($_POST['IdCliente'], "int"),
GetSQLValueString($_POST['IdProducto'], "int"),
GetSQLValueString($_POST['FormaPago'], "text"),
GetSQLValueString($_POST['Cheque'], "double"),
GetSQLValueString($_POST['Cantidad'], "double"),
GetSQLValueString($_POST['Total'], "double"));

mysql_select_db($database_empresa, $empresa);
$Result1 = mysql_query($insertSQL, $empresa) or die(mysql_error());
}

$colname_usuario = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_usuario = $_SESSION['MM_Username'];
}
mysql_select_db($database_empresa, $empresa);
$query_usuario = sprintf("SELECT Usuario FROM clientes WHERE Usuario = %s", GetSQLValueString($colname_usuario, "text"));
$usuario = mysql_query($query_usuario, $empresa) or die(mysql_error());
$row_usuario = mysql_fetch_assoc($usuario);
$totalRows_usuario = mysql_num_rows($usuario);

mysql_select_db($database_empresa, $empresa);
$query_ventas = "SELECT * FROM ventas";
$ventas = mysql_query($query_ventas, $empresa) or die(mysql_error());
$row_ventas = mysql_fetch_assoc($ventas);
$totalRows_ventas = mysql_num_rows($ventas);
?>
  #6 (permalink)  
Antiguo 04/11/2015, 18:11
 
Fecha de Ingreso: noviembre-2015
Ubicación: Neptunia, Canelones
Mensajes: 12
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Página Web con envío de datos por Dreamweaver

continua código de pag ventas 2ª parte:

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<style type="text/css">
.Estilo1 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-style: italic;
color: #0000FF;
}
.Estilo2 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 24px;
font-weight: bold;
font-style: italic;
color: #FF0000;
}
.Estilo3 { color: #FFFFFF;
font-style: italic;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
}
.texto {
font-weight: bold;
color: #FFF;
}
.texto em {
color: #F00;
font-size: x-large;
}
.centrar {
text-align: center;
}
.texto {
font-weight: bold;
}
</style>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>

<body onload="MM_preloadImages('button1_2.gif','button2_ 2.gif','button3_2.gif','button4_2.gif','button5_2. gif','button7_2.gif')">
<table width="931" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="357" rowspan="2"><img src="fastimport.jpg" alt="fastimport" width="368" height="137" /></td>
<td width="109" height="90"><div align="center"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','button1_2.g if',1)"><img src="button1.gif" width="99" height="21" id="Image4" /></a> </div></td>
<td width="117"><div align="center"><a href="catalogo.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','button2_2.g if',1)"><img src="button2.gif" width="103" height="30" id="Image5" /></a> </div></td>
<td width="116"><div align="center"><a href="ingreso_clientes.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','button3_2.g if',1)"><img src="button3.gif" width="103" height="30" id="Image6" /></a> </div></td>
<td width="117"><div align="center"><a href="login.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','button4_2.g if',1)"><img src="button4.gif" width="103" height="30" id="Image7" /></a> </div></td>
<td width="115"><div align="center"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','button5_2.g if',1)"><img src="button5.gif" width="103" height="30" id="Image8" /></a> </div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><em><strong>USUARIO:</strong></em></td>
<td><?php
if(isset($_SESSION['MM_Username'])){
echo $_SESSION['MM_Username'];
}
?>&nbsp;</td>
<td><a href="<?php echo $logoutAction ?>" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','button7_2.g if',1)"><img src="button7.gif" width="99" height="21" id="Image9" /></a></td>
</tr>
</table>
<table width="931" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#0000CC">&nbsp;</td>
</tr>
</table>
<p class="texto"><em>Proceda a rellenar los siguientes datos para efectivizar la compra:</em></p>
<p class="centrar">&nbsp;</p>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Factura:</td>
<td><input type="text" name="Factura" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nombre:</td>
<td><input type="text" name="Nombre" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Telefono:</td>
<td><input type="text" name="Telefono" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Direccion:</td>
<td><input type="text" name="Direccion" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Producto:</td>
<td><input type="text" name="Producto" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">IdCliente:</td>
<td><input type="text" name="IdCliente" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">IdProducto:</td>
<td><input type="text" name="IdProducto" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">FormaPago:</td>
<td><input type="text" name="FormaPago" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Cheque:</td>
<td><input type="text" name="Cheque" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Cantidad:</td>
<td><input type="text" name="Cantidad" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Total:</td>
<td><input type="text" name="Total" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">&nbsp;</td>
<td><input type="submit" value="Insertar registro" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($usuario);

mysql_free_result($ventas);
?>
  #7 (permalink)  
Antiguo 07/11/2015, 08:18
Avatar de Rafael
Modegráfico
 
Fecha de Ingreso: marzo-2003
Mensajes: 9.028
Antigüedad: 21 años, 1 mes
Puntos: 1826
Respuesta: Página Web con envío de datos por Dreamweaver

La realidaad es que nadie te va a leer 3 páginas de código.

Si tú no sabes programar entonces necesitas contratar a alguien que lo haga.
  #8 (permalink)  
Antiguo 07/11/2015, 18:04
 
Fecha de Ingreso: noviembre-2015
Ubicación: Neptunia, Canelones
Mensajes: 12
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Página Web con envío de datos por Dreamweaver

Sí, quizás me excedí un poco en el código publicado... No obstante, creo mi problema debe ser más común de lo que parece. Lo único que quiero es extraer de una página la info de una tabla dinámica (no de un form de ingreso) que muestra datos de una tabla de phpMyAdmin, y luego mostrar esa información en otra página ahí si dentro de un form de ingreso. Como dije antes, no manejo mucho el código PHP (solo un nivel muuuuy principiante), agradecería q ALGUIEN QUE ME PUEDA DAR UNA IDEA AUNQUE SEA VAGA!, usando variables de sesion o algo parecido...
  #9 (permalink)  
Antiguo 07/11/2015, 18:08
 
Fecha de Ingreso: noviembre-2015
Ubicación: Neptunia, Canelones
Mensajes: 12
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Página Web con envío de datos por Dreamweaver

Este es el extracto de código de la página que muestra los datos (o sea de la tabla dinámica) y desde la cual deseo extraer algunos (los campos Número ID, Nombre y Precio) :

<div align="center">
<?php do { ?>
<table width="490" border="0" align="center">
<tr>
<td width="179"><strong>Número ID:</strong></td>
<td width="301"><?php echo $row_empresa['Id']; ?></td>
</tr>
<tr>
<td><strong>Foto:</strong></td>
<td><img src="<?php echo $row_empresa['Foto']; ?>" alt="foto" /></td>
</tr>
<tr>
<td><strong>Nombre:</strong></td>
<td><?php echo $row_empresa['Nombre']; ?></td>
</tr>
<tr>
<td><strong>Descripción:</strong></td>
<td><?php echo $row_empresa['Descripcion']; ?></td>
</tr>
<tr>
<td><strong>Precio:</strong></td>
<td><?php echo $row_empresa['Precio']; ?></td>
</tr>
<tr>
<td><strong>Fecha de ingreso:</strong></td>
<td><?php echo $row_empresa['Fecha']; ?></td>
</tr>
<tr>
<td><strong>Stock:</strong></td>
<td><?php echo $row_empresa['Stock']; ?></td>
</tr>
<tr>
<td><div align="center">
<?php if ($pageNum_empresa > 0) { // Show if not first page ?>
<strong class="Anterior"><em><a href="<?php printf("%s?pageNum_empresa=%d%s", $currentPage, max(0, $pageNum_empresa - 1), $queryString_empresa); ?>">&lt;&lt; Anterior</a></em></strong>
<?php } // Show if not first page ?>
</div></td>
<td><div align="center">
<?php if ($pageNum_empresa < $totalPages_empresa) { // Show if not last page ?>
<strong class="Siguiente"><em><a href="<?php printf("%s?pageNum_empresa=%d%s", $currentPage, min($totalPages_empresa, $pageNum_empresa + 1), $queryString_empresa); ?>">Siguiente &gt;&gt;</a></em></strong>
<?php } // Show if not last page ?>
</div></td>
</tr>
</table>
<?php } while ($row_empresa = mysql_fetch_assoc($empresa)); ?>
</div>
  #10 (permalink)  
Antiguo 07/11/2015, 18:12
 
Fecha de Ingreso: noviembre-2015
Ubicación: Neptunia, Canelones
Mensajes: 12
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Página Web con envío de datos por Dreamweaver

Y este el botón COMPRAR que se ubica debajo de la grilla anterior y que permite "comprar" el artículo mostrado. El usuario, al hacer clic en él, pasa a otra página (pág 'ventas') para efectivizar la compra en la que se le pide que rellene algunos datos. En esa otra página es en donde yo quiero mostrar la info de los campos que mencioné antes (para que el usuario no los tenga q volver a reescribir):

<p align="center"><a href="ventas.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','button6_2.g if',1)"><img src="button6.gif" width="103" height="30" id="Image" /></a> </p>
<p>&nbsp; </p>
  #11 (permalink)  
Antiguo 07/11/2015, 18:15
 
Fecha de Ingreso: noviembre-2015
Ubicación: Neptunia, Canelones
Mensajes: 12
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Página Web con envío de datos por Dreamweaver

Otra vez agradezco me puedan dar alguna idea... Y sé que me excedí en mostrar el código anterior, pero bue, no todos somos perfectos cheeee!!!
  #12 (permalink)  
Antiguo 07/11/2015, 23:09
Avatar de xfxstudios  
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: Página Web con envío de datos por Dreamweaver

en ese caso solo debes complementar la tabla dinamica con un enlace que contenga la id de la fila mostrada y en la pagina destino una consulta basada en la id que envias, algo asi mas o menos:

el enlace
Código HTML:
Ver original
  1. <a href="pagina.php?id=<?php echo $row['id']; ?>">Editar</a>

pagina destino con el formulario

Código PHP:
Ver original
  1. //recibimos la id
  2.  
  3. $id = $_get['id'];
  4.  
  5. //buscamos los datos
  6. $busca = $db->query("select * from tabla where id = '$id'");
  7. $total = mysqli_num_rows($busca);
  8. $row = $busca->fetch_assoc();

y los campos del formulario quedarian algo asi:


Código HTML:
Ver original
  1. <input type="text" name="campo" value="<?php echo $row['campo']; ?>"/>

y asi con cada campo del form que tenga que mostrar algo de la consulta, estos son solo ejemplos pero es la idea bàsica de lo que entiendo que necesitas
__________________
[email protected]
HITCEL
  #13 (permalink)  
Antiguo 09/11/2015, 19:25
 
Fecha de Ingreso: noviembre-2015
Ubicación: Neptunia, Canelones
Mensajes: 12
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Página Web con envío de datos por Dreamweaver

Muchisimas gracias xfxstudios por la respuesta! entendí casi todo, ahora bien, tengo un par de consultas: 1º, en la pagina destino, en qué parte del código declaro la variable $id? 2º, la consulta la puedo crear con el panel vinculaciones de dreamweaver en modo avanzado?, en cuyo caso dreamweaver me coloca la siguiente SQL:

SELECT*
FROM producto
WHERE Id=colname

donde 'colname' la define con valor predeterminado -1 y valor de tiempo de ejecución $_GET['Id']

Me gustaría que se pudiera recoger la variable pasada por URL desde este panel, ya que, como he dicho antes, no manejo mucho el código php.

Por último, el resto de código de búsqueda que tú me indicas, en que parte del código html de la página iría? Es necesario escribirlo o lo puedo hacer desde el ya comentado panel vinculaciones?

PD: si lo hago con el panel vinculaciones, usando la consulta mostrada antes, me sale en el cuadro vínculo <?php echo $row_IdProducto['Id']; ?> como valor inicial. Está mal?

Agradezco vuestro interés y disculpen por mi ignorancia...
  #14 (permalink)  
Antiguo 09/11/2015, 19:37
Avatar de xfxstudios  
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: Página Web con envío de datos por Dreamweaver

Mi primera recomendacion es que te olvides, o te vallas olvidando del panel de vinculaciones ya que eso esta obsoleto, es decir, todavia trabaja basado en mysql y no mysqli asi que lo mejor es que vallas de a poco aprendiendo a escribir el codigo, te lo digo por experiencia, yo uso dreamweaver, pero no sus paneles ya desde hace algo de tiempo.

Segundo la variable id la declaras en cualquier parte del codigo php siempre que este antes de la query a ejecutar con ella.

Tercero: reitero lo primero, olvida el panel de vinculaciones, la mejor forma de aprender es escribir el codigo por si mismo asi tenga errores, es mejor, ya que de los errores aprendemos y mejoramos. ademas a l a final por mucho que quieras, vas a tener que escribir el codigo porque los paneles trabajan con escritos preetablecidos y a la final vas a tener que manualmente editarlos.

Saludos
__________________
[email protected]
HITCEL
  #15 (permalink)  
Antiguo 28/11/2015, 18:29
 
Fecha de Ingreso: noviembre-2015
Ubicación: Neptunia, Canelones
Mensajes: 12
Antigüedad: 8 años, 5 meses
Puntos: 0
Respuesta: Página Web con envío de datos por Dreamweaver

Gracias xfxstudios por las respuestas. Al final pude solucionar mi problema, lo hice con lo menos de programación posible, jeje.

La solucion fue colocar el botón de compra dentro de la tabla dinámica. No me funcionaba porque yo lo habia puesto por fuera, ahora si me trae los datos de los campos que necesitaba por url hacia la página destino... Gracias de nuevo y saludos!

Etiquetas: diseño, dreamweaver, formularios, php, tablas, variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:26.