alguien me podria decir, jeje mas bien escribir como puedo mandar a la pantalla los valores del form2 de este codigo:
Código PHP:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>insertar registros</title>
</head>
<body>
<script language = "Javascript">
function ivatotal() {
var subtotal = event.srcElement.value
var iva = Math.round(subtotal*.15*100)/100
var total = Math.round(subtotal*1.15*100)/100
document.form2.fac_iva.value=iva
document.form2.fac_total.value=total
}
</script>
<script>
function add_row(campo)
{
cadena="";
total=campo.options[campo.selectedIndex].value;
for(i=1;i<=total;i++)
cadena=cadena+'<input type="text" name="campo_'+i+'" /> <input type="text" name="campo_'+i+'" /> <input type="text" name="campo_'+i+'" /> <input type="text" name="campo_'+i+'" /> <input type="text" name="campo_'+i+'" /><br>';
document.getElementById('campos').innerHTML = cadena;
}
</script>
<form action="fac_final.php" method="post" name="form2">
<p>
<select name="opciones" onChange="add_row(this)">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
</select>
</p>
<table width="759" border="1">
<tr>
<th width="141" scope="col">cantidad</th>
<th width="144" scope="col">unidad</th>
<th width="143" scope="col">descripcion</th>
<th width="144" scope="col">p unitario</th>
<th width="153" scope="col">importe</th>
</tr>
</table>
<div id="campos"></div>
<label>
subtotal
<input type="text" name="fac_subtotal" id="textfield" onkeyup="javascript:ivatotal()">
</label>
<p>iva
<label>
<input type="text" name="fac_iva" id="textfield2">
</label>
</p>
<p>total
<label>
<input type="text" name="fac_total" id="textfield3">
</label>
</p>
<input name="enviar" type="submit" value="Enviar">
</form>
<p><a href="busqueda_cliente.php"><img src="flecha_re.gif" width="22" height="22" /></a></p>
</body>
</html>
<?php
mysql_free_result($fact);
mysql_free_result($Recordset1);
?>
Código PHP:
<?php require_once('Connections/facturas.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
?><?php
require_once('Connections/facturas.php');
require('pdfclass/class.ezpdf.php');?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_fact = "-1";
if (isset($_GET['id'])) {
$colname_fact = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_facturas, $facturas);
$query_fact = sprintf("SELECT * FROM cliente_fac WHERE id = %s ORDER BY nom_clien ASC", GetSQLValueString($colname_fact, "int"));
$fact = mysql_query($query_fact, $facturas) or die(mysql_error());
$row_fact = mysql_fetch_assoc($fact);
$totalRows_fact = mysql_num_rows($fact);
$colname_Recordset1 = "-1";
if (isset($_GET['id'])) {
$colname_Recordset1 = $_GET['id'];
}
mysql_select_db($database_facturas, $facturas);
$query_Recordset1 = sprintf("SELECT * FROM variables WHERE id = %s ORDER BY id DESC", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $facturas) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$x1=$row_fact['id'];
$x2=$row_fact['nom_clien'];
$x3=$row_fact['dom_clien'];
$x4=$row_fact['ciud_clien'];
$x5=$row_fact['tel_clien'];
$x6=$row_fact['rfc_clien'];
$x7=$row_fact['no_clien'];
$pdf =& new Cezpdf();
$pdf->selectFont('includes/pdfclass/fonts/Helvetica.afm');
$data =array(
array($x61,'type'=>$x2));
$pdf->addJpegFromFile('facturacarpi.jpg',25,50,550);
$pdf->ezSetY(660);
$pdf->ezText(" ".$x2,9);
$pdf->ezSetY(640);
$pdf->ezText(" ".$x3);
$pdf->ezSetY(620);
$pdf->ezText(" ".$x4);
$pdf->ezSetY(604);
$pdf->ezText(" ".$x5." ".$x6." ".$x7);
$pdf->ezSetY(550);
$pdf->ezStream();
mysql_free_result($fact);
mysql_free_result($Recordset1);
?>