• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Slight problem with PHP and Apache **SOLVED**

JW310

Golden Member
I'm running an Apache 1.3.24 webserver with PHP 4.2.1, and it works pretty well with a couple exceptions. Getting built-in variables to work, and getting variables passed between pages. You can see what I mean here, which is supposed to show the browser being used as well as the IP address of the person viewing the page, and here, which takes the data input into the text fields and on the next page is supposed to echo back what was input.

Anyone have any input as to what I need to do to get everything to work right? Is this possibly an issue with the version of PHP and/or Apache I'm running?

Thanks in Advance,
JW
 
I had exactly the same problem. You need something like this:

$variable=$_POST['formfieldname'];

That should work. $variable is the variable, and formfieldname is the name of the field of the form. Give that a try...
 
Excellent, that worked... Thank you very much!
How about the problem I'm having in the first situation where it's supposed to use the built-in PHP variables to show the browser name and IP address of the viewer? The source for that page is below:

<html>
<body>
<p>You are using
<?php echo $HTTP_USER_AGENT; ?>

and coming from
<?php print $REMOTE_ADDR; ?>

</body>
</html>

Any help with that?

Thanks again,
JW
 
Hmm... that didnt' seem to work. Put the variable name in single quotes and it just echoed back the variable name. Put it in double quotes, and it again didn't do what it's supposed to do. I'm at a loss as to why it isn't working how it should 😕

JW
 
I just looked this up on the php website. It seems that you need to do this for the first part:

<?php echo $_SERVER["HTTP_USER_AGENT"]; ?>

and for the second part:

<?php echo $_SERVER["REMOTE_ADDR"]; ?>

These changes were made for php 4.21. $HTTP_USER_AGENT and $REMOTE_ADDR as well as others are no longer global variables. They can only be accessed through the $_SERVER[""] function.
 
Many thanks for the help... serves me right for not going to the PHP manual first on their site before posting here 🙂

JW
 
Back
Top