Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/10/2009, 16:39
Nisrokh
 
Fecha de Ingreso: septiembre-2009
Ubicación: Neuquén
Mensajes: 142
Antigüedad: 15 años, 4 meses
Puntos: 12
Respuesta: funciones en php

Si las funciones Aprobar() y Eliminar() que tienes en el atributo onclick de los input, son funciones PHP, no te va a funcionar...

te doy un ejemplo de como se hace:

Código php:
Ver original
  1. <?php
  2.  
  3. // Aca unas funciones bien simples...
  4. function incrementar($valor) {
  5.     return ++$valor;
  6. }
  7.  
  8. function reducir($valor) {
  9.     return --$valor;
  10. }
  11.  
  12. // Si se envia el formulario
  13. if ($_POST['submit']) {
  14.     if ($_POST['accion'] == 'incrementar') $nuevoValor = incrementar($_POST['valor']);
  15.     if ($_POST['accion'] == 'reducir') $nuevoValor = reducir($_POST['valor']);
  16.    
  17.     print "<h4>{$nuevoValor}</h4>";
  18. }
  19.  
  20. // El formulario
  21. print <<<FORM
  22. <form method="post">
  23.     <input type="text" name="valor" />
  24.     <select name="accion">
  25.         <option selected="selected">-- Accion --</option>
  26.         <option value="incrementar">Incrementar</option>
  27.         <option value="reducir">Reducir</option>
  28.     </select>
  29.     <input type="submit" name="submit" value="Enviar" />
  30. </form>
  31. FORM;
  32.  
  33. ?>