Foros del Web » Programando para Internet » PHP »

traer los valores del form del link anterior a un pdf

Estas en el tema de traer los valores del form del link anterior a un pdf en el foro de PHP en Foros del Web. hola, 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> ...
  #1 (permalink)  
Antiguo 09/09/2008, 09:09
 
Fecha de Ingreso: septiembre-2008
Mensajes: 58
Antigüedad: 15 años, 7 meses
Puntos: 0
traer los valores del form del link anterior a un pdf

hola,

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);
?>
y pues kiero mandar en este pdf los valores del form2 pero no tengo idea de como hacerlo, este es el codigo ke tengo asta aorita del pdf ke solo me aparece el nombre de mi cliente

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);
?>

Última edición por GatorV; 09/09/2008 a las 09:29 Razón: tags PHP
  #2 (permalink)  
Antiguo 09/09/2008, 09:27
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: traer los valores del form del link anterior a un pdf

este se le conoce como manejo de variables externas.... fácilmente en el manual de PHP esta documentado

Enlace:

http://www.php.net/variables.external

suerte!
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 09/09/2008, 09:31
 
Fecha de Ingreso: septiembre-2008
Mensajes: 58
Antigüedad: 15 años, 7 meses
Puntos: 0
Respuesta: traer los valores del form del link anterior a un pdf

aa ok gracias deja lo leo
  #4 (permalink)  
Antiguo 09/09/2008, 09:31
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: traer los valores del form del link anterior a un pdf

Usa $_POST['fac_iva'] y $_POST['fac_total'] para obtener los valores en tu script PHP.

Saludos.
  #5 (permalink)  
Antiguo 09/09/2008, 09:36
 
Fecha de Ingreso: septiembre-2008
Mensajes: 58
Antigüedad: 15 años, 7 meses
Puntos: 0
Respuesta: traer los valores del form del link anterior a un pdf

ya lo vi y lo lei mas o menos,

pero no me dice nada acerka de un pdf, es ke nno se si es igual ke en el php o las variables se marcan diferentes
  #6 (permalink)  
Antiguo 09/09/2008, 10:21
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: traer los valores del form del link anterior a un pdf

No importa si es PDF, o HTML, el chiste es obtener las variables desde tu script, para eso usas $_POST si el formulario tiene como metodo post, o usas $_GET si el formulario asi lo especifica o si obtienes variables desde el URL.

Saludos.
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 06:47.