tengo un formulario que en el que tengo 3 diferentes productos, para cada producto tengo 3 tamaños diferentes.
Tengo 3 archivos diferentes
style.css
Código HTML:
#capaexpansion1{
position:relative;
display:none;}
#capaexpansion2{
position:relative;
display:none;}
#capaexpansion3{
position:relative;
display:none;}
#capaexpansion4{
position:relative;
display:none;}
#capaexpansion5{
position:relative;
display:none;}
Código HTML:
var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xNN4,xUA=navigator.userAgent.toLowerCase();if(window.opera){var i=xUA.indexOf('opera');if(i!=-1){var v=parseInt(xUA.charAt(i+6));xOp7Up=v>=7;xOp6Dn=v<7;}}else if(navigator.vendor!='KDE' && document.all && xUA.indexOf('msie')!=-1){xIE4Up=parseFloat(navigator.appVersion)>=4;xIE4=xUA.indexOf('msie 4')!=-1;xIE5=xUA.indexOf('msie 5')!=-1;}else if(document.layers){xNN4=true;}xMac=xUA.indexOf('mac')!=-1;function xDef(){for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}return true;}function xDisplay(e,s){if(!(e=xGetElementById(e))) return null;if(e.style && xDef(e.style.display)) {if (xStr(s)) e.style.display = s;return e.style.display;}return null;}function xGetElementById(e){if(typeof(e)!='string') return e;if(document.getElementById) e=document.getElementById(e);else if(document.all) e=document.all[e];else e=null;return e;}function xStr(s){for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='string') return false;}return true;}
function expandir_formulario(){
if (document.new_order.orden_producto.value == "0"){
xDisplay('capaexpansion1', 'none')
xDisplay('capaexpansion2', 'none')
xDisplay('capaexpansion3', 'none')
xDisplay('capaexpansion4', 'none')
xDisplay('capaexpansion5', 'none')
}
if (document.new_order.orden_producto.value == "1"){
xDisplay('capaexpansion1', 'block')
xDisplay('capaexpansion2', 'none')
xDisplay('capaexpansion3', 'none')
xDisplay('capaexpansion4', 'none')
xDisplay('capaexpansion5', 'none')
}
if (document.new_order.orden_producto.value == "2"){
xDisplay('capaexpansion1', 'none')
xDisplay('capaexpansion2', 'block')
xDisplay('capaexpansion3', 'none')
xDisplay('capaexpansion4', 'block')
xDisplay('capaexpansion5', 'none')
}
if (document.new_order.orden_producto.value == "3"){
xDisplay('capaexpansion1', 'none')
xDisplay('capaexpansion2', 'none')
xDisplay('capaexpansion3', 'block')
xDisplay('capaexpansion4', 'block')
xDisplay('capaexpansion5', 'none')
}
if (document.new_order.orden_producto.value == "4"){
xDisplay('capaexpansion1', 'none')
xDisplay('capaexpansion2', 'none')
xDisplay('capaexpansion3', 'none')
xDisplay('capaexpansion4', 'block')
xDisplay('capaexpansion5', 'none')
}
if (document.new_order.orden_producto.value == "5"){
xDisplay('capaexpansion1', 'none')
xDisplay('capaexpansion2', 'none')
xDisplay('capaexpansion3', 'none')
xDisplay('capaexpansion4', 'none')
xDisplay('capaexpansion5', 'block')
}
}
Código HTML:
($_POST['boton'])
{
$orden_producto = isset($_POST['orden_producto'])? $_POST['orden_producto']: '';
$orden_tamano = isset($_POST['orden_tamano'])? $_POST['orden_tamano']: '';
$orden_envio = isset($_POST['orden_envio'])? $_POST['orden_envio']: '';
if($cliente_nombre=="" || $cliente_domicilio=="" || $cliente_pais=="" || $cliente_ciudad=="" || $cliente_email=="" || $orden_fotografo=="" || $orden_venta=="" || $orden_lugar=="" || $orden_producto=="" || $orden_tamano=="" || $orden_archivos==""){
echo '<script name="accion">alert("All fields are required.")</script>';
}elseif(!intval($cliente_cp)){
echo '<script name="accion">alert("Please enter POSTAL CODE below.")</script>';
}elseif(!intval($cliente_telefono)){
echo '<script name="accion">alert("Please enter PHONE NUMBER below.")</script>';
}else{
$sql="INSERT INTO photo_order (cliente_nombre, cliente_domicilio, cliente_cp, cliente_pais, cliente_ciudad, cliente_telefono, cliente_email, orden_fotografo, orden_venta, orden_lugar, orden_producto, orden_tamano, orden_envio, orden_archivos, orden_notas, orden_fecha) VALUES ('".$cliente_nombre."', '".$cliente_domicilio."', '".$cliente_cp."', '".$cliente_pais."', '".$cliente_ciudad."', '".$cliente_telefono."', '".$cliente_email."', '".$orden_fotografo."', '".$orden_venta."', '".$orden_lugar."', '".$orden_producto."', '".$orden_tamano."', '".$orden_envio."', '".$orden_archivos."', '".$orden_notas."', '".$orden_fecha."')";
mysql_query($sql) or die (mysql_error());
$numero_orden = mysql_insert_id();
include 'send.php';
}
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type='text/javascript' src='formexp.js'></script>
<link href="style.css" media="screen" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="../Imag/favicon.ico">
<title>Photo Adventures - Nueva Orden</title>
</head>
<body>
<center><div align="left" id="photostyle">
<form action="" method="POST" name="new_order">
<input type="hidden" name="opt" />
<fieldset id="order-information">
<h3>Order Information</h3>
<div class="required field">
<div id="capainicio">
<label for="Product">Product<span><span>This product was registered in the order.</span></span></label>
<select id="orden_producto" name="orden_producto" onchange="expandir_formulario()">
<option value="" Selected>Select One</option>
<option value="Photo_Book">Photo Book</option>
<option value="Canvas_Roll">Canvas Roll</option>
<option value="Canvas_Gallery_Wrapped">Canvas Gallery Wrapped</option>
<option value="">-------------------------------------------------------------------</option>
</select>
</div><br/>
<!-- Diferente Capas-->
<!-- Capa 1-->
<div id="capaexpansion1">
<label for="Size">Size<span><span>Size Photo Book.</span></span></label>
<select id="orden_tamano" name="orden_tamano">
<option>Select One</option>
<option value="Extra Book 40 pages - $49.00">Extra Book 40 pages - $49.00</option>
<option value="Extra book 80 pages - $69.00">Extra book 80 pages - $69.00</option>
<option value="FREE WITH PURCHASE OF 15 PICTURES">FREE WITH PURCHASE OF 15 PICTURES </option>
<option>-------------------------------------------------------------------</option>
</select>
</div>
<!-- Capa 2-->
<div id="capaexpansion2">
<label for="Size">Size<span><span>Size Canvas Roll.</span></span></label>
<select id="orden_tamano" name="orden_tamano">
<option>Select One</option>
<option value="12 x 18 roll - $49.00">12 x 18 roll - $49.00</option>
<option value="16x24 roll - $99.00">16x24 roll - $99.00</option>
<option value="20x30 roll - $129.00">20x30 roll - $129.00</option>
<option value="24x36 roll - $149.00">24x36 roll - $149.00</option>
<option>-------------------------------------------------------------------</option>
</select>
</div>
<!-- Capa 3-->
<div id="capaexpansion3">
<label for="Size">Size<span><span>Size Canvas Gallery Wrapped.</span></span></label>
<select id="orden_tamano" name="orden_tamano">
<option>Select One</option>
<option value="12 x18 Gallery Wrapped - $69.00">12 x18 Gallery Wrapped - $69.00</option>
<option value="16x24 Gallery Wrapped - $119.00">16x24 Gallery Wrapped - $119.00</option>
<option value="20x30 Gallery Wrapped - $149.95">20x30 Gallery Wrapped - $149.95</option>
<option value="24x36 Gallery Wrapped - $199.00">24x36 Gallery Wrapped - $199.00</option>
<option>-------------------------------------------------------------------</option>
</select>
</div>
<!-- Capa 4-->
<div id="capaexpansion4"><br/>
<label for="Shipping">Shipping & Handling<span><span>Shipping & handling charge.</span></span></label>
<select id="orden_envio" name="orden_envio">
<option value="Free " selected="selected">Select One</option>
<option value="USA / CAN / MX - $14.95">USA / CAN / MX - $14.95</option>
<option value="International - $39.95">International - $39.95</option>
<option>-------------------------------------------------------------------</option>
</select>
</div>
</div>
</fieldset>
<div class="submit">
<input type="submit" value="New Order" onclick="verifica()" name="boton"/></div>
</form>
</div>
</center>
</body>
</html> alguna sugerencia
Ya le cale con selected, pero sigue igual porque entonces me deja la variable en blanco.

