Foros del Web » Programando para Internet » PHP »

Pasar Variables Post a Get

Estas en el tema de Pasar Variables Post a Get en el foro de PHP en Foros del Web. Tengo un formulario el cual manda valores de variables a un archivo.php usando el metodo POST Código HTML: <form metod=post> pero dentro de ese archivo.php ...
  #1 (permalink)  
Antiguo 07/12/2005, 21:20
Avatar de xyyy7  
Fecha de Ingreso: enero-2004
Ubicación: Maracay.-
Mensajes: 637
Antigüedad: 20 años, 2 meses
Puntos: 5
Pasar Variables Post a Get

Tengo un formulario el cual manda valores de variables a un archivo.php usando el metodo POST
Código HTML:
<form metod=post> 
pero dentro de ese archivo.php tengo un include php que esta configurado para que reciva valores de variables por metodo GET

este es parte del archivo que tengo como include

Código PHP:
<?php
$INCLUDE_DIR 
"../";

require(
"phpunit.php");
require(
$INCLUDE_DIR "class.phpmailer.php");
error_reporting(E_ALL);

class 
phpmailerTest extends TestCase
{

    var 
$Mail false;

    var 
$Host "";
    

    var 
$ChangeLog = array();

    var 
$NoteLog = array();   

    function 
phpmailerTest($name) {
        
/* must define this constructor */
        
$this->TestCase$name );
    }

    function 
setUp() {
        global 
$global_vars;
        global 
$INCLUDE_DIR;

        
$this->Mail = new PHPMailer();

        
$this->Mail->Priority 3;
        
$this->Mail->Encoding "8bit";
        
$this->Mail->CharSet "iso-8859-1";
        
$this->Mail->From "[email protected]";
        
$this->Mail->FromName "test";
        
$this->Mail->Sender "";
        
$this->Mail->Subject "Test";
        
$this->Mail->Body "";
        
$this->Mail->AltBody "";
        
$this->Mail->WordWrap 0;
        
$this->Mail->Host $global_vars["mail_host"];
        
$this->Mail->Port 25;
        
$this->Mail->Helo "localhost.localdomain";
        
$this->Mail->SMTPAuth false;
        
$this->Mail->Username "";
        
$this->Mail->Password "";
        
$this->Mail->PluginDir $INCLUDE_DIR;
        
$this->Mail->AddReplyTo("[email protected]""[email protected]");
        
$this->Mail->Sender "[email protected]";

        if(
strlen($this->Mail->Host) > 0)
            
$this->Mail->Mailer "smtp";
        else
        {
            
$this->Mail->Mailer "mail";
            
$this->Sender "[email protected]";
        }
        
        global 
$global_vars;
        
$this->SetAddress($global_vars["correo"], "Usuarios");
        if(
strlen($global_vars["mail_cc"]) > 0)
            
$this->SetAddress($global_vars["mail_cc"], "Usuarios""cc");
    }     


    function 
tearDown() {
        
// Clean global variables
        
$this->Mail NULL;
        
$this->ChangeLog = array();
        
$this->NoteLog = array();
    }

    function 
BuildBody() {
        
$this->CheckChanges();
        
      
        if(
$this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0)
        {
            
$eol "<br/>";
            
$bullet "<li>";
            
$bullet_start "<ul>";
            
$bullet_end "</ul>";
        }
        else
        {
            
$eol "\n";
            
$bullet " - ";
            
$bullet_start "";
            
$bullet_end "";
        }
        
        
$ReportBody "";

        
        if(
strlen($this->Mail->Host) > 0)
            
$ReportBody .= "Host: " $this->Mail->Host $eol;
        
        
// If attachments then create an attachment list
        
if(count($this->Mail->attachment) > 0)
        {
        print 
"";

        }
        
        
// If there are changes then list them
        
if(count($this->ChangeLog) > 0)
        {
        print 
"";

        }
        
// ....Y MUCHO MAS!
AHORA BIEN? quien me da una ayudadita con este code? sera que hay una forma de hacer funcionar ese include con las variables que estoy mandando desde mi formulario de manera POST..
o habra una manera de combertir las variables pasadas de manera post A -> GET

gracias amigos
__________________
Maracay Edo Aragua - Venezuela :
Mi Favorita :
http://www.MySQL.Com

Última edición por jam1138; 08/12/2005 a las 05:57
  #2 (permalink)  
Antiguo 08/12/2005, 06:05
Avatar de jam1138
/** @package Moderador */
 
Fecha de Ingreso: julio-2004
Ubicación: sèveR led onieR lE
Mensajes: 9.368
Antigüedad: 19 años, 8 meses
Puntos: 102
... no veo las variables $_GET que dices.... pero soluciones fáciles:

1) Usar $_REQUEST como sustituto de $_GET y $_POST... con lo que implica (recibir datos sin fijarse la forma)

2)... hacer una asignación directa. Es válido (debería):
Código PHP:
$_GET['algo']= $_POST['algo']; 
Insisto.. como soluciones fáciles.

Saludos!
__________________
٩(͡๏̯͡๏)۶
» Cómo hacer preguntas de manera inteligente «

"100 años después, la revolución no es con armas, es intelectual y digital"
  #3 (permalink)  
Antiguo 08/12/2005, 06:22
Avatar de Seppo  
Fecha de Ingreso: marzo-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.284
Antigüedad: 19 años, 1 mes
Puntos: 17
Para pasar las variables POST a GET en el mismo archivo se puede utilizar un foreach

Código PHP:
foreach ($_POST as $campo => $valor) {
  
$_GET[$campo] = $valor;

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 11:34.