LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-03-2007, 08:46 PM   #1
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Rep: Reputation: 2
PHP variable code works on Windows Server but not Linux Server


Hi all. I have written an application that uses PHP, Apache, and MySQL. It is for lot tracking some materials for the company that I work for. I downloaded a premade WAMP (Windows, Apache, MySQL, PHP) stack to run on my laptop and made my application. Everything about it seemed to work fine when I moved it over to my company's Linux (LAMP) server, but later I realized that one key variable was not getting passed between pages like it should have been. I moved the file back to my windows box and it still worked. When I look at my database, it becomes obvious to me that $pqid does not get passed from the intermediate page. $pqid is a value that is POST'ed from a form in a primary page to my intermediate page, and I use a hidden field in a form (on my intermediate page) to pass it to the (final) processing page. The final processing page does not seem to get the value passed to it on my Linux box. That said, I doubt that my problem is a Linux/Windows problem, but rather an issue in some PHP setting that I missed. I have looked at the phpinfo() files for both servers, and assume that they hold my answer, but I am overwhelmed at the sheer volume of (mostly meaningless to me) data. My code is below; appreciate your help:

PHP Code:
<?php

while (list($name$value) = each($HTTP_POST_VARS))

    { 

    echo 
"<input type=\"hidden\" value=\"$value\" name=\"$name\">\n"

    } 

?>
This code is within a "POST" type form, and the value for $pqid is posted to the intermediate page, where this code lives.
 
Old 07-04-2007, 01:17 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
First your problem at hand: There is a directive in the php.ini file that can turn off access to the $HTTP_POST_VARS variable (it is better to use $_POST) this directive is called register_long_arrays and is available for the version 5 family of PHP.

Finally I can't leave without suggesting that you should be storing the value as a session variable and then it doesn't need to go into a hidden variable.
 
Old 07-05-2007, 02:23 PM   #3
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 2
Fantastic! Changing $HTTP_POST_VARS to $_POST did the trick! As for session variables, I had previously given them a shot, and couldn't get them to work. I am a newbie when it comes to PHP, and I want to learn and improve my coding skills, but was pushed into writing some PHP for a work project that didn't leave me much time to learn. Thanks for your help!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows PHP connect into LINUX server rocket1356 Linux - Newbie 5 06-14-2007 08:22 AM
FTP Server that works on Windows and Linux VicRic Linux - Software 1 02-21-2007 04:07 AM
Server load code Apache+PHP mindfrost82 Linux - Software 1 01-03-2005 11:43 AM
Sending mail with PHP on linux machine through exchange on Windows server 2003 TVScoundrel Linux - Newbie 1 06-18-2004 02:22 PM
Sending mail with PHP on linux machine through exchange on Windows server 2003 TVScoundrel Linux - Networking 2 06-18-2004 01:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration