Ver Mensaje Individual
  #7 (permalink)  
Antiguo 26/05/2011, 07:56
isabellawebs
Usuario no validado
 
Fecha de Ingreso: diciembre-2009
Ubicación: Bogotá
Mensajes: 462
Antigüedad: 14 años, 5 meses
Puntos: 18
Respuesta: Base de datos con phpmyadmin para pedir citas

Ya he avanzado mucho, tengo ya toda mi bd cuadrada para lograr mi objetivo: Pero tengo un dilema aqui:

La explicación de quim fv me llevó a modificar mi bd para bien y ahora estoy ante algo muy bueno, ya logré gran parte (por no decir todo) lo que necesitaba pero necesito colaboración con esto:

Los selectores o listas fucionan bien, pero no he podido hacer que se envie el formulario. Porque si le quito el "onchange="submit()" a la lista, deha de funcionar la lista dinámica es decir, el juego........ y si le meto el codigo de dreamweaver para enviar formulario pues funciona menos, porque lo que hace es que cuando selecciono la segunla lista de menú , se envia el formulario antes de presionar el botón.

Cómo puedo enviar este formulario despues de la segunda lista presionando el botón?

<?php require_once('Connections/citasjoya.php'); ?>
<?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_citasjoya, $citasjoya);
$query_rc_tipo = "SELECT * FROM tablatipotramites";
$rc_tipo = mysql_query($query_rc_tipo, $citasjoya) or die(mysql_error());
$row_rc_tipo = mysql_fetch_assoc($rc_tipo);
$totalRows_rc_tipo = mysql_num_rows($rc_tipo);

$colname_rc_hora = "-1";
if (isset($_POST['idtramite'])) {
$colname_rc_hora = $_POST['idtramite'];
}
mysql_select_db($database_citasjoya, $citasjoya);
$query_rc_fecha = "SELECT * FROM tablafechas";
$rc_fecha = mysql_query($query_rc_fecha, $citasjoya) or die(mysql_error());
$row_rc_fecha = mysql_fetch_assoc($rc_fecha);
$totalRows_rc_fecha = mysql_num_rows($rc_fecha);

$colname_rc_hora = "-1";
if (isset($_POST['idfecha'])) {
$colname_rc_hora = $_POST['idfecha'];
}
mysql_select_db($database_citasjoya, $citasjoya);
$query_rc_hora = sprintf("SELECT idhora, hora FROM tablahoras WHERE idfecha = %s", GetSQLValueString($colname_rc_hora, "int"));
$rc_hora = mysql_query($query_rc_hora, $citasjoya) or die(mysql_error());
$row_rc_hora = mysql_fetch_assoc($rc_hora);
$totalRows_rc_hora = mysql_num_rows($rc_hora);
?>
<!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=iso-8859-1" />
<title>Joya Pabón - Sitio para solicitud de tablacitas</title><link rel="shortcut icon" href="favicon.ico" />
<link type="text/css" rel="stylesheet" href="css/joyapabon.css" />
</head>

<body>
<div align="center">
<table width="1024" border="0">
<tr>
<td width="507"><a href="index.php" target="_self"><img src="images/logo_joya.png" width="249" height="70" alt="Joya Pabón" /></a></td>
<td width="507">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="middle">&nbsp;</td>
<td align="center" valign="middle">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="middle"><p class="textogrande">Hola , <br />
Saca tu cita!</p>
<p class="textomediano">Selecciona la fecha y tablahoras en que quieres visitarnos.</p>
<p class="textomediano">Para nosotros, eres lo mas importante.</p></td>
<td align="center" valign="middle"><div align="center"><form id="form1" name="form1" method="post" action="">
<table width="60" border="0">
<table width="194" border="0">
<tr>
<td class="etiquetas">Fecha</td>
<td><select name="idfecha" class="campos" id="idfecha" onchange="submit()">
<option value="" <?php if (!(strcmp("", $_POST['idfecha']))) {echo "selected=\"selected\"";} ?>>Fecha</option>
<?php
do {
?>
<option value="<?php echo $row_rc_fecha['idfecha']?>"<?php if (!(strcmp($row_rc_fecha['idfecha'], $_POST['idfecha']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rc_fecha['fecha']?></option>
<?php
} while ($row_rc_fecha = mysql_fetch_assoc($rc_fecha));
$rows = mysql_num_rows($rc_fecha);
if($rows > 0) {
mysql_data_seek($rc_fecha, 0);
$row_rc_fecha = mysql_fetch_assoc($rc_fecha);
}
?>
</select></td>
</tr>
<tr>
<td class="etiquetas">Hora</td>
<td><select name="idhora" class="campos" id="idhora">
<option value="" <?php if (!(strcmp("", $_POST['idhora']))) {echo "selected=\"selected\"";} ?>>Hora</option>
<?php
do {
?>
<option value="<?php echo $row_rc_hora['idhora']?>"<?php if (!(strcmp($row_rc_hora['idhora'], $_POST['idhora']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rc_hora['hora']?></option>
<?php
} while ($row_rc_hora = mysql_fetch_assoc($rc_hora));
$rows = mysql_num_rows($rc_hora);
if($rows > 0) {
mysql_data_seek($rc_hora, 0);
$row_rc_hora = mysql_fetch_assoc($rc_hora);
}
?>
</select></td>
</tr>
<tr>
<td class="etiquetas">&nbsp;</td>
<td><input type="submit" name="enviar" id="enviar" value="Enviar" />
</tr>
</table>
<tr>
</form>
</td>
</tr>
<tr>
<td align="left" valign="middle">&nbsp;</td>
<td align="center" valign="middle">&nbsp;</td>
</tr>
<tr>
<td height="219" colspan="2" align="center" valign="bottom">&nbsp;</td>
</tr>
</table>
</div>
<tr>
<td height="230" colspan="2" align="center" valign="bottom">&nbsp;</td>
</tr>
</body>
</html>
<?php
mysql_free_result($rc_fecha);

mysql_free_result($rc_hora);

mysql_free_result($rc_tipo);
?>