You are here: Passing $_POST to a function « All PHP « IT news, forums, messages
Passing $_POST to a function

Posted by Squet34785 on 11/06/06 20:35

Hello,
A script in an existing website I'm looking after has suddenly stopped
working. There is a PHP file which containts this code:

include ( 'library.php' );
showRecord ( $_POST );

Inside library.php the function looks like this:

function showRecord ( $post ){
//get vars
$table_name = $post [ 'table_name' ];
....

Which was working fine until the other day. Now $table_name comes back
blank, as does everything in $post. No one has changed the server config as
far as I know. I temporarily fixed the problem by changing the function call
to use the old style $HTTP_POST_VARS, but other scripts on the site failing
in the same way and I'd rather find out why rather keep patching scripts.

Does anyone know why this might have started happening?

P.S. I created a test script which looks like this:

<form action="<?=$PHP_SELF?>" method="POST">
<input type="text" name="username" value="Rob"> <input type="submit"
value="Say Hello">
</form>
<?php
if ($_POST["username"]){
sayHello($_POST);
}

function sayHello($post){
echo("<p>Hello " . $post["username"] . "</p>");
}
?>

Which seems to work fine, so I have no idea what's going on!

 

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

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