converting a 10 line cgi to php.

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

  1. edge

    edge HowtoForge Supporter

    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

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

    falko Super Moderator

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

    edge HowtoForge Supporter

    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

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

     
  6. falko

    falko Super Moderator

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

    sjau Local Meanie

    or a foreach ^^

    or without key:
     

Share This Page