You are here: Re: HELP: Getting input from perl cgi to PHP. « PHP Programming Language « IT news, forums, messages
Re: HELP: Getting input from perl cgi to PHP.

Posted by Justin Koivisto on 08/10/05 19:16

Ray Muforosky wrote:

> I have this:
> ------------
>
> print "<FORM name=\"form3\" ACTION=\"cmdlog_rep.php\">\n";
> print "<TD><INPUT TYPE=\"submit\" VALUE=\"Submit\"></TD>\n";
> .
> print "<INPUT type=\"HIDDEN\" name=\"year1\" >\n";
> print "<INPUT type=\"TEXT\" name=\"when\" >\n";
> print "</FORM>\n";
>
> if click on submit I get this:
> ------------------------------
> http://cpstmws2/p/cmdlog_rep.php?when=0&year1=
>
>
> and I can't get the values here:
> --------------------------------
>
> <?php
>
> // set server access variables
> $when = $_REQUEST['when'];
> $year1 = $_REQUEST['year1'];
> .
> .
> echo $when;
> echo "<BR>";
> echo $year1;
> echo "<BR> The test ends here\n";
> ?>
> ---------------------------------
> What am I doing wrong?

Try this:
<?php
echo '<pre>';
print_r($_GET);
echo'</pre>';
?>

You should get something like:
array(
[when] = 0
[year1] =
)

Then you can use:
echo $_GET['when'],'<br>',
$_GET['year1'],'<br>',
'The test ends here';

You might want to put in a method attribute for the form as well:
print "<FORM name=\"form3\" method=\"get\" ACTION=\"cmdlog_rep.php\">\n";

If you use "post" as the method, then change the $_GET to $_POST

HTH

--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация