Ver Mensaje Individual
  #4 (permalink)  
Antiguo 10/01/2006, 02:35
mekir
 
Fecha de Ingreso: noviembre-2005
Mensajes: 55
Antigüedad: 18 años, 5 meses
Puntos: 0
Uno.

Hola:

En realidad comprendo que no me hayan respondido ya que el pedido es bastante engorroso y ninguno de nosotros dispone del tiempo suficiente para hacer tantas modificaciones, he descubierto esto por la inmensa cantidad de horas que le he dedicado y si no es alguien con conocimientos avanzados es posible que le hubiese pasado lo mismo.

A pesar de ser un principiante en estos temas, he avanzado mucho y estoy muy cerca de lograrlo, pero me quedé trabado en el siguiente punto y ya no sé como resolverlo : cuando entro en " select.php " no me muestra nada en la 4ta ventana, pero si selecciono algo en las 3 primeras opciones y pulso "ENVIAR" luego en la pagina de resultados SALE COMO YO LO NECESITO !, es decir en la cuarta ventana me da la posibilidad de elegir otra opción además de la ya seleccionada en la 3er ventana, y si pulso " back " también los devuelve Ok.

Creo que es poco lo que me falta ( quizás alguna instrucción o variable ) pero ya no sé que hacer para lograrlo, por eso les pido por favor si alguien puede darme una mano con esto, sinceramente lo necesito para que funcione de esta forma.

Desde ya muy agradecido por las respuestas que me puedan enviar.

Envío los archivos divididos en 3 post porque tengo un límite de caracteres.

Son 7 en total, (respecto a los originales están modificados : select.php, select_rs.php, result.php y selectphp.js) :


************************************************** ****
************************************************** ****

1) createdb.sql:

# phpMyAdmin MySQL-Dump
#
# Host: localhost
# Database : `selectdemo`
# --------------------------------------------------------

#
# Table structure for table `makes`
#

CREATE TABLE makes (
makeID tinyint(3) unsigned NOT NULL auto_increment,
makeName varchar(20) NOT NULL default '',
PRIMARY KEY (makeID)
) TYPE=MyISAM;

#
# Dumping data for table `makes`
#

INSERT INTO makes VALUES (1,'Ford');
INSERT INTO makes VALUES (2,'Pontiac');
INSERT INTO makes VALUES (3,'Chevrolet');
INSERT INTO makes VALUES (4,'Hyundai');
INSERT INTO makes VALUES (5,'Porsche');
# --------------------------------------------------------

#
# Table structure for table `models`
#

CREATE TABLE models (
modelID tinyint(3) unsigned NOT NULL auto_increment,
modelName varchar(20) NOT NULL default '',
makeID tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (modelID)
) TYPE=MyISAM;

#
# Dumping data for table `models`
#

INSERT INTO models VALUES (1,'Escort',1);
INSERT INTO models VALUES (2,'Mustang',1);
INSERT INTO models VALUES (3,'Windstar',1);
INSERT INTO models VALUES (4,'Sunfire',2);
INSERT INTO models VALUES (5,'Firebird',2);
INSERT INTO models VALUES (6,'Montana',2);
INSERT INTO models VALUES (7,'Cavalier',3);
INSERT INTO models VALUES (8,'Camaro',3);
INSERT INTO models VALUES (9,'Venture',3);
INSERT INTO models VALUES (10,'Elantra',4);
INSERT INTO models VALUES (11,'Sonata',4);
INSERT INTO models VALUES (12,'Carrera',5);
# --------------------------------------------------------

#
# Table structure for table `options`
#

CREATE TABLE options (
optionID tinyint(3) unsigned NOT NULL auto_increment,
optionName varchar(20) NOT NULL default '',
modelID tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (optionID)
) TYPE=MyISAM;

#
# Dumping data for table `options`
#

INSERT INTO options VALUES (1,'Air Conditioning',1);
INSERT INTO options VALUES (2,'ABS Brakes',1);
INSERT INTO options VALUES (3,'Cup Holder',1);
INSERT INTO options VALUES (4,'Racing Stripes',2);
INSERT INTO options VALUES (5,'Spoiler',2);
INSERT INTO options VALUES (6,'Mag Wheels',2);
INSERT INTO options VALUES (7,'Cargo Cover',3);
INSERT INTO options VALUES (8,'Bed Seat',3);
INSERT INTO options VALUES (9,'Roof Rack',3);
INSERT INTO options VALUES (10,'CD Player',4);
INSERT INTO options VALUES (11,'Spoiler',4);
INSERT INTO options VALUES (12,'2-Tone Paint',4);
INSERT INTO options VALUES (13,'Tinted Windows',5);
INSERT INTO options VALUES (14,'Toilet Brush',6);
INSERT INTO options VALUES (15,'Socket Wrench',6);
INSERT INTO options VALUES (16,'Fan Belt',7);
INSERT INTO options VALUES (17,'Muffler',7);
INSERT INTO options VALUES (18,'V8',8);
INSERT INTO options VALUES (19,'Fuel Injection',8);
INSERT INTO options VALUES (20,'Driver Side Door',9);
INSERT INTO options VALUES (21,'Radio',10);
INSERT INTO options VALUES (22,'Seats',11);
INSERT INTO options VALUES (23,'Mirrors',11);
INSERT INTO options VALUES (24,'Whale Tail',12);

************************************************** ****
************************************************** ****

2) select.php:

<html>
<head>
<title>JSRS Select Demo</title>
<script language="javascript" src="jsrsClient.js"></script>
<script language="javascript" src="selectphp.js"></script>
<style>
body{background:#dddddd;text-align:center;}
#sel {width:100%;margin: 0px auto 0px auto;}
#show {background-color:darkgray;width:80%;height:45px;text-align:center;margin-top:15px;padding-top:10px;}
</style>
</head>
<?php
$make = isset($_POST['lstMake']) ? $_POST['lstMake'] : -99;
$model = isset($_POST['lstModel']) ? $_POST['lstModel'] : -99;
$options = isset($_POST['lstOptions']) ? $_POST['lstOptions'] : -99;
$options2 = isset($_POST['lstOptions2']) ? $_POST['lstOptions2'] : -99;
?>
<body onload="preselect('<?php echo $make;?>', '<?php echo $model;?>', '<?php echo $options;?>', '<?php echo $options2;?>', 1);" onhelp="jsrsDebugInfo();return false;">
<h2>JSRS Select Box Filling Demo - page #1</h2>
<form name="QForm" method="post" action="./result.php">
<div id="sel">
<table class="normal" width="575" BORDER="0" CELLSPACING="2" CELLPADDING="2" VALIGN="TOP">
<?php
SelectBox ("Make", "lstMake");
SelectBox ("Model", "lstModel");
SelectBox ("Options", "lstOptions");
SelectBox ("Options2", "lstOptions2");
?>
</table>
<div id="show">
<input type="submit" name="cmdSubmit" value="Submit" id="cmdSubmit" title="Show selects with preselected values" style="" /><br />
(submits to second page which preselects current values in another form like this)
</div>
</div>
</form>

<p>
Make your selections. Dependent selections will be filled with data from the server.
Change selections and dependencies will change.
</p>
<p>
<a href=>Download</a> the files for this Select Demo.
</p>
<p>
<a href=>View</a> the source for the server-side file Select_rs.PHP
</p>
<p>
<a href="">Return</a> to Brent's Remote Scripting page.
</p>
</body>
</html>
<?php

function SelectBox( $Label, $selectName ){
?>
<tr ALIGN="LEFT">
<td width="15%"><?php echo $Label ?></td>
<td align="left">
<select name="<?php echo $selectName ?>">
<option></option><option></option><option></option>
<option>--------- Not Yet Loaded ---------</option>
</select>
</td>
</tr>
<?php
}
?>

************************************************** ****
************************************************** ****

3) select_rs.php:

<?php

require("jsrsServer.php.inc");
jsrsDispatch( "makeList modelList optionsList optionsList2" );

function makeList() {
return serializeSql( "select makeID, makeName from makes order by makeName" );
}

function modelList( $makeID ){
return serializeSql("select modelID, modelName from models where makeID=" . $makeID . " order by modelName");
}

function optionsList( $modelID ){
return serializeSql("select optionID, optionName from options where modelID=" . $modelID . " order by optionName");
}

function optionsList2( $modelID ){
return serializeSql("select optionID, optionName from options where modelID=" . $modelID . " order by optionName");
}



function serializeSql( $sql ){
$link = mysql_connect("localhost", "root", "");
mysql_select_db ("selectdemo");
$result = mysql_query ($sql);
$s = '';
while ($row = mysql_fetch_row($result)) {
$s .= join( $row, '~') . "|";
}

mysql_close($link);
return $s;
}

?>

************************************************** ****
************************************************** ****