converting a 10 line cgi to php.

Discussion in 'Programming/Scripts' started by edge, Jun 2, 2006.

  1. edge

    edge Active Member Moderator

    Could some CGI, PHP expert please show me how this small CGI script should look like in PHP?

    The CGI script:
    Code:
    #!/usr/bin/perl
    use CGI;
    
    my $cgi = CGI->new();
    my @param = $cgi->param();
    
    print"Content-type: text/html\n\n";
    for(@param)
    {
     my @arr = $cgi->param($_);
     print"$_:".join(':',@arr)."<br>";
    }
    
    All I got till now in PHP is:
    Code:
    <?php
    
    echo "Content-type: text/html\n\n";
    
    ?>
    

    Please help.. I'm lost...
     
  2. sjau

    sjau Local Meanie Moderator

    You want to loop through an array?
    I don't know Perl... but PHP ^^
     
  3. falko

    falko Super Moderator ISPConfig Developer

    I'm no Perl expert either... What does the CGI script do?
     
  4. edge

    edge Active Member Moderator

    It's some code that will dump/show a variable..

    I've now recoded it in the language I know best.. Coldfusion :)
    No need for the PHP code anymore.
     
  5. sjau

    sjau Local Meanie Moderator

    For showing a variable in PHP it's straight-forward:

     
  6. falko

    falko Super Moderator ISPConfig Developer

    If it's an array, then use
    PHP:
    <?php
    print_r
    ($arr);
    ?>
     
  7. sjau

    sjau Local Meanie Moderator

    or a foreach ^^

    or without key:
     

Share This Page