Thanks for the quick reply.  I wasn't sure which room I should post to, so I
posted to this one and php.windows.  I will only try one in the future.

I went through all the documents I could and found what these warnings were,
but nothing helped.  The variables are not passed to my second script.  I
went ahead and changed my form and my script.  So, pass.php now looks like
this...
<form action="pass1.php" method="post">
    Name:  <input type="text" name="username" /><br />
    <input type="submit" name="submit" value="Submit me!" />
</form>
Only username is being passed to pass1.php.

I then incorporated the code you sent me into pass1.php.  It is now like
this.
<?php
// Available since PHP 4.1.0
   if (isset($_POST['username']))
   {
       echo $_POST['username'];
   }
?>
I do not receive any output now.  Besides the CGI error.  I can find out
about this later, but it should be outputting the username.

"Chris Hewitt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tue, 2004-08-17 at 16:46, Chuck wrote:
> > Hello everyone.  Hopefully someone can help me with this.
> >
> > I was able to install PHP successfully.  I tried a sample script and it
> > worked fine through IE.  I then tried to create a script that would pass
a
> > value on to another script using the post method.  These are called
Pass.php
> > and Pass1.php.
> >
> > Pass.php contains the following.
> > <form action="pass1.php" method="post">
> >     Name:  <input type="text" name="username" /><br />
> >     Email: <input type="text" name="email" /><br />
> >     <input type="submit" name="submit" value="Submit me!" />
> > </form>
> >
> > Pass1.php contains the following.
> > <?php
> > // Available since PHP 4.1.0
> >    echo $_POST['username'];
> >    echo $_REQUEST['username'];
> >    import_request_variables('p', 'p_');
> >    echo $p_username;
> > // Available since PHP 3. As of PHP 5.0.0, these long predefined
> > // variables can be disabled with the register_long_arrays directive.
> >    echo $HTTP_POST_VARS['username'];
> > // Available if the PHP directive register_globals = on. As of
> > // PHP 4.2.0 the default value of register_globals = off.
> > // Using/relying on this method is not preferred.
> >    echo $username;
> > ?>
>
> You only have "username" and "email" in your form, so I would remove the
> others. Your form uses the method POST so that is all you need in the
> page your form submits to.
>
> If you look up the warning messages you get (they are warnings) they
> will tell you that they are warning you that you have used the variable,
> e.g. in
> echo $_POST['username'];
> before assigning a value. Either assign a value or test for it first,
> then you do not receive the warning. You could change the error level in
> php.ini alternatively if you wanted to. So changing the above line to:
> if (isset($_POST['username']))
> {
> echo $_POST['username'];
> }
> should avoid the warning.
>
> As to your CGI error issue, it sounds as though you are using PHP as a
> CGI with IIS. I do not use this combination so I cannot help on that
> one. I know this is a known error message but I have not been able to
> find out about it, now I want to.
>
> Regards
>
> Chris
> PS Please do not cross-post to more than one list.

Reply via email to