RE: [PHP-WIN] (should be) easy questions from a beginner

From: Date: Tue, 27 Mar 2001 09:01:07 +0000
Subject: RE: [PHP-WIN] (should be) easy questions from a beginner
Groups: php.windows 
Request: Send a blank email to php-windows+get-6314@lists.php.net to get a copy of this message
> 1. Why when I use $PHP_SELF, I get the file referenced twice? Ex: in > file hello.php I have > > <?php > echo $PHP_SELF ; > ?> > > and the result is: /cgi-bin/hello.phpcgi-bin/hello.php This one beats me... :) Try one of the 'other', like $SCRIPT_NAME and see if it works the same... > 2. I set up the following right from PHP.net FAQ: > > <?php > while (list($var, $value) = each($HTTP_POST_VARS)) { > echo "$var = $value<br>\n"; > } > ?> > > but this does nothing. The FORM that is posted has four text INPUT's. This one may be easy: are you using the 'name' attributes? e.g. you have to use something like this on your form: <input type=text name=whatever ...> ^^^^^^^^^^^^^ THEN you'll be able to refer to that field using $whatever and it will be included in $HTTP_POST_VARS. > This script is called from a JavaScript function that is called from an > HTML FORM submit as follows: > > function SubmitIt() { > top.frames["myframe"].location = '/cgi-bin/hello.php' ; > } > > I understand that php4.0.4pl1 automatically track system variable ... ? > I don't think this will work: you're not actually submiting anything this way; all you're doing is calling the script on another frame, and that will probably not send any data along with it... If you want your results to appear in a diferent frame, you'll have to do it some other way, like using redirects or something... > 3. I cannot get the form submit to work with the above if I set: > > ACTION="<?php echo /cgi-bin/hello.php ?>" I don't see why you want to do that: is the script name to be variable depending on who is requesting the page? This is probably happening because you're trying to use a tag ('<?') inside another tag ('<form...>') If you MUST do it, try this instead: <? $script_name = '/cgi-bin/hello.php'; $form = '<FORM ACTION=" . $script_name . "etc...>'; echo $form; ?> ... rest of the form html ... HTH, Madruga

« previous php.windows (#6314) next »