Re: Problem with php execution and variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SenTnel wrote:
Thank you Shawn!

Just to make sure, "the long way" IS the correct way?

Thanks again!



Shawn McKenzie wrote:
SenTnel wrote:
Hello!

Im new to programing and this is the situation I have with a first level
basic php tutorial: One of the samples uses a simple order form that
submits
to this page and is supposed to return the values entered on that form.
This
is the code not working:


<?
  echo "<p>Your order"; // Start printing order

  echo date("jS F,H:i ");
  echo "<br>";
  echo "<p>This is your order:";
  echo "<br>";
  echo $actionqty." ActionScript<br>";
  echo $photoqty." Photoshop<br>";
  echo $flashqty." Flash MX<br>";
?>


The problem is that with this code my page does not shows the amounts
entered in he form, but the tutorial works with the exact same code,
then,
the same tutorial showed another "long way" to do the same thing and is
using this other code that works on my page:

<?
  echo "<p>Your order"; // Start printing order

  echo date("jS F,H:i ");
  echo "<br>";
  echo "<p>This is your order:";
  echo "<br>";
  echo $HTTP_POST_VARS["actionqty"]." ActionScript<br>";
  echo $HTTP_POST_VARS["photoqty"]." Photoshop<br>";
  echo $HTTP_POST_VARS["flashqty"]." Photoshop<br>";
?>

I want to use the short way, why doesn't work on my server? Do I have to
set
some settings in php configuration to be able to use php in the short
format?

Thanks !
To use your 'short way' you need register_globals=on which is a security risk/bad practice. You can use a 'shorter than the long way' which is the way you should be doing it anyway (BTW... your tutorial is old):

echo $_POST['actionqty']." ActionScript<br>";

-Shawn

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





Using $_POST is the correct way unless you are on an old version of PHP, in which case you would have to use $HTTP_POST_VARS which may or may not work on newer versions, so stick with $_POST.

-Shawn

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux