Foros del Web » Programando para Internet » PHP »

ayuda con un tema super simple pero me supera

Estas en el tema de ayuda con un tema super simple pero me supera en el foro de PHP en Foros del Web. hola amigos soy nuevo en el foro hace un tiempo programo en php y resulta ke tengo una duda y keria ver si me pueden ...
  #1 (permalink)  
Antiguo 12/05/2010, 12:44
 
Fecha de Ingreso: mayo-2010
Ubicación: valpo_UC
Mensajes: 34
Antigüedad: 13 años, 11 meses
Puntos: 0
ayuda con un tema super simple pero me supera

hola amigos soy nuevo en el foro hace un tiempo programo en php y resulta ke tengo una duda y keria ver si me pueden ayudar.

mi problema es el sgt tengo echa la pagina index la cual toma 18 datos letras y numero ahora solo los numericos tengo ke multiplicarlos por algun valor por ejemplo la variable "txtimpresion" la multiplike por "54.75" resulta ke puedo hacer ke me liste el resultado pero no ke me los multiplike porfa si me pueden ayudar se los agradeceria mucho.


Este es el Index.php

Código:
<style type="text/css">
<!--
body {
	background-color: #CCCCCC;
}
body,td,th {
	color: #000000;
}
.Estilo1 {color: #0099FF}
.Estilo2 {color: #000000}
.Estilo3 {color: #CCCCCC}
-->
</style>  <form name="form1" method="POST" action="formulario.php">
    <label><strong>Centro Costos</strong><span class="Estilo3">............</span>
    <input type="text" name="txtcostos" id="txtcostos" />
    </label>
    <strong>Nombre Solicitante	</strong>
    <label>
  <input type="text" name="txtnombre" id="txtnombre" />
  </label>
  <p><strong>Nom Trabajador<span class="Estilo3">.........</span></strong> 
    <label>
    <input type="text" name="txttrabaja" id="txttrabaja" /> 
    </label>
    <strong>Impresion B/ N</strong><span class="Estilo3">......	</span>          
    <label>
  	<input type="text" name="txtimpresion" id="txtimpresion" />
  </label>
  </p>
  <p><strong>Impresion Color</strong><span class="Estilo3">.........	</span> 
    <label>
    <input type="text" name="txtcolor" id="txtcolor" />
    </label>
    <strong>Scanner</strong><span class="Estilo3">..................	.</span>  
    <label>
    <input type="text" name="txtscan" id="txtscan" />
    </label>
  </p>
  <p><strong>Hoja Carta B</strong><span class="Estilo1"><span class="Estilo2">lanca</span><span class="Estilo3"><strong>.</strong>....</span> </span>
    <label>
    <input type="text" name="txtcarta" id="txtcarta" />
    </label>
    <strong>Hoja Oficio Blanca</strong><span class="Estilo1">.	.</span>
    <label>
  <input type="text" name="txtoficio" id="txtoficio" />
  </label>
  </p>
  <p><strong>Hoja Carta Amarilla<span class="Estilo3">..	</span></strong>
    <label>
    <input type="text" name="txtcamarilla" id="txtcamarilla" />
    </label>
    <strong>Hoja Oficio Amarilla	</strong>  
    <label>
    <input type="text" name="txtoamarilla" id="txtoamarilla" />
    </label>
  </p>
  <p><strong>Hoja Doble Carta<span class="Estilo3">......</span></strong> 
    <input type="text" name="txthdoblec" id="txthdoblec" />
    <strong>Corchetes<span class="Estilo1"><span class="Estilo3">...............	..</span></span></strong>  
    <span class="Estilo1">
    <label>    </label>
    </span>
    <label>
    <input type="text" name="txtcorchetes" id="txtcorchetes" />
    </label>
  </p>
  <p><strong>Bond Blanca</strong></p>
  <p><strong>Opalina Oficio B<span class="Estilo3">.......	</span></strong>
    <span class="Estilo3">
    <label>    </label>
    </span>
    <label>
    <input type="text" name="txtopab" id="txtopab" />
    </label>
    <label><strong>Opalina Oficio C<span class="Estilo3">.....	..</span></strong>
    <input type="text" name="txtopac" id="txtopac" />
    </label>
  </p>
  <p><strong>Lomo Negro<span class="Estilo3">............	</span> </strong>
    <label>
    <input type="text" name="txtlomonc" id="txtlomonc" />
    </label>
    <strong>Lomo Negro<span class="Estilo3">.............	..</span></strong>
    <label></label>
    <label>
    <input type="text" name="txtlomoncm" id="txtlomoncm" />
    </label>
  </p>
  <p><strong>Carta Narrow</strong><span class="Estilo3">.................................................</span><strong>Carta Medium</strong></p>
  <p><strong>Lomo Negro</strong><span class="Estilo3">..............</span>
    <label>
    <input type="text" name="txtlomono" id="txtlomono" />
    </label>
    <strong>Lomo Negro<span class="Estilo3">..............</span></strong>
    <label>
    	<input type="text" name="txtlomonom" id="txtlomonom" />
    </label>
  </p>
  <p><strong>Oficio Narrow<span class="Estilo3">..................................................</span>Oficio Medium</strong></p>
  <p>
    <label><span class="Estilo3">.........................................................................</span></label>
    <input type="submit" name="btnenviar" id="btnenviar" value="Enviar" />
    <span class="Estilo3">
    .....</span></p>
  </form>

formulario.php

Código:
<?php

echo '<font color=\"Red">Centro Costos :</font> '.						$_REQUEST ["txtcostos"].'<br>';
echo '<font color=\"Red">Solicitante :</font> '.						$_REQUEST ["txtnombre"].'<br>';
echo '<font color=\"Red">Nombre Trabajador :</font> ' .					$_REQUEST ["txttrabaja"].'<br>';
echo '<font color=\"Red">Impresion B/N :</font> '.						$_REQUEST ["txtimpresion"].'<br>';
echo '<font color=\"Red">Impresion Color :</font> ' .					$_REQUEST ["txtcolor"].'<br>';
echo '<font color=\"Red">Sacanner :</font> '.							$_REQUEST ["txtscan"].'<br>';
echo '<font color=\"Red">Hoja Oficio Blanca :</font> '. 				$_REQUEST ["txtoficio"].'<br>';
echo '<font color=\"Red">Hoja Carta Amarilla :</font> '.				$_REQUEST ["txtcamarilla"].'<br>';
echo '<font color=\"Red">Hoja Oficio Amarilla :</font> '.  				$_REQUEST ["txtoamarilla"].'<br>';
echo '<font color=\"Red">Hoja Doble Carta Bound Blanca :</font> '.		$_REQUEST ["txthdoblec"].'<br>';
echo '<font color=\"Red">Corchetes :</font> '.							$_REQUEST ["txtcorchetes"].'<br>';
echo '<font color=\"Red">Opalina Oficio Blanca :</font> ' .				$_REQUEST ["txtopab"].'<br>';
echo '<font color=\"Red">Opalina Oficio Color :</font> '.				$_REQUEST ["txtopac"].'<br>';
echo '<font color=\"Red">Lomo Negro Carta Narrow :</font> '.			$_REQUEST ["txtlomonc"].'<br>';
echo '<font color=\"Red">Lomo Negro Carta Medium :</font> '.			$_REQUEST ["txtlomoncm"].'<br>';
echo '<font color=\"Red">Lomo Negro Oficio Narrow :</font> '.			$_REQUEST ["txtlomono"].'<br>';
echo '<font color=\"Red">Lomo Negro Oficio Medium :</font> '.			$_REQUEST ["txtlomonom"].'<br>';
echo ''.'<br>';
echo ''.'<br>';
echo '<a href="index.php">Volver</a> <br>';

?>

Última edición por xpitutox; 12/05/2010 a las 12:50
  #2 (permalink)  
Antiguo 12/05/2010, 14:50
Avatar de lukas4  
Fecha de Ingreso: octubre-2008
Ubicación: frente al pc
Mensajes: 496
Antigüedad: 15 años, 6 meses
Puntos: 12
Respuesta: ayuda con un tema super simple pero me supera

si lo envias/recibes por post podrias hacerlo asi:

Código PHP:
Ver original
  1. <?php
  2. echo "valor: ". $_POST['txtimpresion'] * 54.75;
  3. ?>

un linkd e ayuda :P
http://w3schools.com/php/php_operators.asp
__________________
http://situcomo.blogspot.com
Karma is a Bitch... they said
  #3 (permalink)  
Antiguo 13/05/2010, 07:21
 
Fecha de Ingreso: mayo-2010
Ubicación: valpo_UC
Mensajes: 34
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: ayuda con un tema super simple pero me supera

Cita:
Iniciado por lukas4 Ver Mensaje
si lo envias/recibes por post podrias hacerlo asi:

Código PHP:
Ver original
  1. <?php echo "valor: ". $_POST['txtimpresion'] * 54.75;?>

un linkd e ayuda :P
[URL="http://w3schools.com/php/php_operators.asp"]http://w3schools.com/php/php_operators.asp[/URL]

muchas gracias lukas4 en todo caso cuando lo tenia con $_POST me tirava un error pero el programa funcionaba en fin de todas maneras muchas gracias

ahora tengo esta linea de codigo
Código:
echo '<font color=\"Red">Centro Costos :</font> '.						$_REQUEST ["txtcostos"].'<br>';
como sale ahi la fuente o letra me tiene ke salir en rojo y me sale en azul

siendo ke el color ke le asigne es rojo :S

Última edición por xpitutox; 17/05/2010 a las 12:56
  #4 (permalink)  
Antiguo 13/05/2010, 09:11
Avatar de wiwi74  
Fecha de Ingreso: marzo-2008
Mensajes: 515
Antigüedad: 16 años, 1 mes
Puntos: 10
Respuesta: ayuda con un tema super simple pero me supera

Cita:
Iniciado por xpitutox Ver Mensaje
muchas gracias lukas4 en todo caso cuando lo tenia con $_POST me tirava un error pero el programa funcionaba en fin de todas maneras muchas gracias

ahora tengo esta linea de codigo
Código:
echo '<font color=\"Red">Centro Costos :</font> '.						$_REQUEST ["txtcostos"].'<br>';
como sale ahi la fuente o letra me tiene ke salir en rojo y me sale en azul

siendo ke el color ke le asigne es rojo :S


Mira:

echo '<font color=\'red\'>Rojo :</font><br />';

echo '<font color="red">Rojo :</font><br />';

echo '<font color=\"red\">Verde :</font><br />';

echo '<font color=\"red">Azul :</font><br />';
  #5 (permalink)  
Antiguo 13/05/2010, 10:57
Avatar de lukas4  
Fecha de Ingreso: octubre-2008
Ubicación: frente al pc
Mensajes: 496
Antigüedad: 15 años, 6 meses
Puntos: 12
Respuesta: ayuda con un tema super simple pero me supera

@wiwi74
Cita:
Iniciado por wiwi74 Ver Mensaje
Mira:

echo '<font color=\'red\'>Rojo :</font><br />';

echo '<font color="red">Rojo :</font><br />';

echo '<font color=\"red\">Verde :</font><br />';

echo '<font color=\"red">Azul :</font><br />';
WOW!!! como funciona eso? nuna antes habia visto eso xD

@xpitutox

y esto:
Código PHP:
Ver original
  1. <?php
  2. echo '<font color=\"Red">Centro Costos :</font> '.$_REQUEST ["txtcostos"].'<br>';
  3. echo '<font color=\"Red">Solicitante :</font> '.$_REQUEST ["txtnombre"].'<br>';
  4. echo '<font color=\"Red">Nombre Trabajador :</font> ' . $_REQUEST ["txttrabaja"].'<br>';
  5. echo '<font color=\"Red">Impresion B/N :</font> '.$_REQUEST ["txtimpresion"].'<br>';
  6. echo '<font color=\"Red">Impresion Color :</font> ' .$_REQUEST ["txtcolor"].'<br>';
  7. echo '<font color=\"Red">Sacanner :</font> '.$_REQUEST ["txtscan"].'<br>';
  8. echo '<font color=\"Red">Hoja Oficio Blanca :</font> '. $_REQUEST ["txtoficio"].'<br>';
  9. echo '<font color=\"Red">Hoja Carta Amarilla :</font> '.$_REQUEST ["txtcamarilla"].'<br>';
  10. echo '<font color=\"Red">Hoja Oficio Amarilla :</font> '.$_REQUEST ["txtoamarilla"].'<br>';
  11. echo '<font color=\"Red">Hoja Doble Carta Bound Blanca :</font> '.$_REQUEST ["txthdoblec"].'<br>';
  12. echo '<font color=\"Red">Corchetes :</font> '.$_REQUEST ["txtcorchetes"].'<br>';
  13. echo '<font color=\"Red">Opalina Oficio Blanca :</font> ' .$_REQUEST ["txtopab"].'<br>';
  14. echo '<font color=\"Red">Opalina Oficio Color :</font> '.$_REQUEST ["txtopac"].'<br>';
  15. echo '<font color=\"Red">Lomo Negro Carta Narrow :</font> '.$_REQUEST ["txtlomonc"].'<br>';
  16. echo '<font color=\"Red">Lomo Negro Carta Medium :</font> '.$_REQUEST ["txtlomoncm"].'<br>';
  17. echo '<font color=\"Red">Lomo Negro Oficio Narrow :</font> '.$_REQUEST ["txtlomono"].'<br>';
  18. echo '<font color=\"Red">Lomo Negro Oficio Medium :</font> '.$_REQUEST ["txtlomonom"].'<br>';
  19. echo ''.'<br>';
  20. echo ''.'<br>';
  21. echo '<a href="index.php">Volver</a> <br>';
  22. ?>
lo puedes cambiar a esto:
Código PHP:
Ver original
  1. <font color="red">Centro Costos: </font><?=$_REQUEST["txtcostos"]?></br>
  2. <font color="red">Solicitantes: </font><?=$_REQUEST["txtnombre"]?></br>
  3. y asi sucesivamente
__________________
http://situcomo.blogspot.com
Karma is a Bitch... they said
  #6 (permalink)  
Antiguo 17/05/2010, 07:47
 
Fecha de Ingreso: mayo-2010
Ubicación: valpo_UC
Mensajes: 34
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: ayuda con un tema super simple pero me supera

Amigos me han servido mucho sus consejos muchas gracias a todos los ke cooperaron de verdad :d

ahora si me pudieran decir cual es el codigo para insertar en una base de datos y

para ke cuando inserte datos en una tabla me descuente los implementos de

bodega por ejemplo si ingreso ke ocupe 50 hojas oficio blancas en la tabla

servicios , que a la vez me descuente de la tabla bodega 50 hojas oficio blanca

esto lo puedo hacer kreando un procedimiento en mysql o lo hago con el

programa????


Si me entendieron ke me aconsejan...............

Pero si necesito el codigo de insertar porfa


muchas gracias un eterno agradecido :d

Etiquetas: multiplicar, operaciones, sumar
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 21:20.